Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Force Scroll Bars in Edit Box to 'end' of control
Message
From
17/07/2003 19:50:12
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00810669
Message ID:
00811338
Views:
8
Why dont you do what Rick Strahal does?

Lets say you update the edit box this way.

* chr(13) is for next line)
cNewLine = "NEW DATA COMING IN"+CHR(13)
ThisForm.edtStatus.Value = ThisForm.edtStatus+ cNewline

The above code will scroll off the screen and you wont see the latest data.

Instead set the scroll bars off in the Edit box and update this way:

*SOP
cNewData = "NEW DATA COMING IN"+CHR(13)
cOldData = ThisForm.edtStatus.Value

* Lets say that the height of your edit box allows only 10 lines to display
If Occurs(Chr(13),cOldData) > 11

* This next code gives us the value of the editbox less the topmost line
* giving the impression it scrolls off the top
cOldData = SUBSTR(cOldData,AT(CHR(13),cOldDtat)+1)
* actually what we are doing is dumping the topmost line and then
* append the new line below
ENDIF

ThisForm.edtStatus.Value = cOldData+cNewData
*EOP
In this way the data looks to be flowing off the top of the edit box and you always see the latest data onscreen.

Cheers



>>>>>>>>>>I am using a read only edit box in VFP 7 to display the changing status of some processing.
>>>>>>>>>>Basically, I am updating a memo field in a cursor that is the source and then refreshing the edit box.
>>>>>>>>>>When I refresh the edit box, the vertical scroll bar always moves to the top of the control. A keyboard of CTRL+END in the refresh does not move the scroll bar down.
>>>>>>>>>>As a result, the oldest part of the status is displayed on the form instead of the newest.
>>>>>>>>>>Is there a way to move the scroll bar down?
>>>>>>>>>>Am I using the wrong control?
>>>>>>>>>>
>>>>>>>>>>TIA.
>>>>>>>>>
>>>>>>>>>For the CTRL+END to work you must set the focus to the control first. You can try in the Refresh of the form, to set the focus toi the control, and then set it back to the control you like
>>>>>>>>>
>>>>>>>>>Luis
>>>>>>>>
>>>>>>>>Luis,
>>>>>>>>
>>>>>>>>I added the this.setfocus() in the refresh and that did not appear to help.
>>>>>>>>I then added the setfocus in the other code in the form before calling the controls refresh. This method did not help either except for the LAST update to the edit box. In that case, the scroll bar was at the end.
>>>>>>>
>>>>>>>It has to be added after the refresh method, 'cause if you add it before, the refresh will put the edibox at the beggining again.
>>>>>>>Luis
>>>>>>
>>>>>>Luis,
>>>>>>
>>>>>>No success. Can we just review what I should be doing?
>>>>>>In the refresh of the edit box I have a keyboard '{CTRL+END}'
>>>>>>Its control source is CurStatus.mStatus
>>>>>>In the other coding in the form that wants to update the status I have something like:
>>>>>>replace mstatus with mstatus + 'whatever' in CurStatus
>>>>>>thisform.deboxmStatus.refresh()
>>>>>>thisform.deboxmstatus.setfocus()
>>>>>>
>>>>>>TIA.
>>>>>
>>>>>Sorry to jump in but couldn't you just put the latest message at the start of the editbox?
>>>>>Replace mStatus with "Whatever"+chr(13)+mStatus
>>>>>
>>>>>As far as the original question goes have you tried butting the SetFocus just before the Keyboard command?
>>>>>
>>>>>HTH
>>>>>Caroline
>>>>
>>>>Caroline,
>>>>The purpose of the edit box is to provide a chronologic 'audit' of what occured.
>>>>Also, the user could copy and paste all or part of its contents into an E-mail and I think that users are used to reading top-down.
>>>>For these reasons, IMHO, I think that the newest data should be displayed at the bottom.
>>>>
>>>>To be honest, I have tried so many combinations :( that I can't remember whether I tried putting the set focus just before the keyboard.
>>>
>>>Not to push a point but having the last thing that happened at the top of the list also makes sense. When you place thinks in a ring binder I normally place the most recent pages at the top so that the file is in (reverse) chronological order.
>>>
>>>It makes sense that the editbox must have the focus before you do the keyboard command as the key strokes will go to the active control.
>>>
>>>Also if you are expecting someone to copy and paste you will need to set the control to
>>>.Enabled = .T.
>>>.ReadOnly = .F.
>>>HTH
>>
>>Caroline,
>>I understand your analogy to the 3 ring binder.
>>I am thinking more along the lines of the user reading to me (like a book) what has occured based upon the contents of edit box.
>>I think I would use your 3 ring binder method for notes pertaining to a customer or product where the they are adding to contents over a longer period of time.
>
>Makes sense.
>Sorry I couldn't be of more help.
Previous
Reply
Map
View

Click here to load this message in the networking platform