Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Editbox Scroll Bars 2

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,826
JP
Hi All,
I feel I'm having a super idiot moment, but I have an issue with the editbox control.

I have edit box that has some text in it in a form, and when the form is not EDITING (mode), the disabled editbox doesn't allow for scrolling the text vertically. The visible area is about 8 lines, but it's not uncommon in this memo field for the text to significantly exceed it. But I don't want the user to have to click the "Edit" button, just to be able to read the text by scrolling in it.
Am I missing something stupid? I couldn't find a property to match the behavior.
Suggestions?

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
I too observed the same effect. Setting either .Readonly to .T. or .enabled to .F. meant that I could not use the scroll bar.

However, if you set the method KeyPress() to NODEFAULT, that should let you scroll up and down, but will not let you edit.

Hope I have this correct and that this helps.
 
Combine both tips. It's enough to set Readonly=.T.
What happens if you begin to edit is annoying bing sounds telling you, you can't edit. If you press space for a while, for example, that can last very long

Putting a Nodefault into keypress, like Andrew mentions, will kill that. It also works as standalone solution, but you can't switch code at runtime, so I'd opt for a behaviour depending on the readonly setting. Use this in KeyPress:
Code:
LPARAMETERS nKeyCode, nShiftAltCtrl

If this.ReadOnly
   nodefault
EndIf
Now switching from Readonly=.F. to .T. disables the control.

It's recommendable to let all controls rather go into readonly mode, because copying values can be handy. To have the disabledbackcolor/forecolor you could simply use a readonly_assign method to react to readonly changes with colro changes and make use of the disabled color properties.

Bye, Olaf.



Olaf Doschke Software Engineering
 
Thanks all. Combined all the suggestions, and have it working just as I wanted. Applied it to the subclass, and all the forms with the editbox control work now. Cool.


Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top