Page 1 of 1

XbpMLE() manipulation

Posted: Fri Sep 10, 2010 5:16 am
by reganc
Hi guys

I would like to be able to move the cursor within an MLE so that the bottom line is visible immediately. I want to have an MLE hold progress text and show what is currently being done...

I have tried various things in the past but not found a solution that works reliably.

Does anyone know how to do it?

Re: XbpMLE() manipulation

Posted: Fri Sep 10, 2010 5:40 am
by Tom

Code: Select all

@ 1,1 DCMULTILINE cText OBJECT oText ... EVAL {||oText:Enter := {||oText:SetFirstChar(Len(cText))}}
or, more unspecific:

Code: Select all

EVAL {|o|o:Enter := {|a,x,o|o:SetFirstChar(Len(o:EditBuffer()))}

Re: XbpMLE() manipulation

Posted: Fri Sep 10, 2010 7:17 am
by reganc
Tom wrote:

Code: Select all

@ 1,1 DCMULTILINE cText OBJECT oText ... EVAL {||oText:Enter := {||oText:SetFirstChar(Len(cText))}}
or, more unspecific:

Code: Select all

EVAL {|o|o:Enter := {|a,x,o|o:SetFirstChar(Len(o:EditBuffer()))}
Thanks Tom...that was a great help!

I made a small function (with the only paramter being the mle object) which also did a setdata() to make sure the string had been updated, used editbuffer to get the position, setmarked to move the cursor there and the whole thing is wrapped in a lockupdate / invalidaterect block to stop any flickering.

Works like a charm...

Re: XbpMLE() manipulation

Posted: Fri Sep 10, 2010 8:03 am
by Tom
Hi, Regan.
that was a great help!
:)

BTW, if it's something like a protocol viewer, moving to the bottom can also be done inside the function which updates the MLE contens. Same code.

Re: XbpMLE() manipulation

Posted: Fri Sep 10, 2010 8:21 am
by rdonnay
Regan -

I always thought that browsing an array was easier to use for progress text.

I would add the next line of text to the array, do a oBrowse:goBottom() and refresh the browse.

Roger

Re: XbpMLE() manipulation

Posted: Fri Sep 10, 2010 8:38 am
by Tom
Hi, Roger.

This is in fact easier, but it limits the to-be-added text to the column width. So, you need to format/break the (new) text if your protocol function adds multi-lined information.

Re: XbpMLE() manipulation

Posted: Fri Sep 10, 2010 8:51 am
by rdonnay
Good point.

Re: XbpMLE() manipulation

Posted: Sat Sep 11, 2010 10:00 am
by Auge_Ohr
offtopic :

btw. did you know how to set Tabstop in a XbpMLE() ?