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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Still seeking help with EditBox

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,828
JP
All,
I posted this message several days ago, and didn't receive a response, so at the risk of it having been lost among the masses over the weekend, I'll throw it out again. Any suggestions at all on how to solve this problem are welcome!

Original Post:
Is there a way to tell when the scroll bar section of an edit box is "ON", i.e. when the text contained in the box exceeds the size of the current viewable area? Obviously Fox has some way of detecting this, because it only "Activates" the scroll abaility when the text is too big for the box.
The reason I am trying to find this is, I've created edit boxes that "Autoexpand" that is to say, when you cursor into them, their size automatically gets larger, to make it easier to see the content. What I'm trying to find a way to do now is to only make this happen when the text actually exceeds the current visible size, otherwise there's no real need to "Expand" the box. Any help?
Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Scott,

Sorry I can't help with your request, the edit box is one of the most 'underequipped' controls - I have had to kludge together all kinds of scrappy stuff to make it simulate columns and stuff like that.

Does anyone have any ideas?

Regards

Regards

Griff
Keep [Smile]ing
 
Hi...

Check out the Fox Extension Classes The interface series....they have an editbox class.

Download a demo at:


Best

Tom Gahagan
edrest@alltel.net

REST



If you get a chance to sit out or dance...

I hope you dance. L Wommack
 
Hello Scott,

I found your question here while looking for an answer to my own identical one. Did you ever dig up a solution?
Thanks,
BillvV


 
HI

You can roughly achieve this, by a caluculation oh height and width..

In the refresh of the Grid, add the code..

n= SET("MemoWIDTH")
IF LEN(This.Value)/n = INT(LEN(This.Value)/n)
This.Height = ((Len(This.Value)/n)*16) + 20
ENDIF

You can call this code in the KeyPressEvent also.. so that as the user keys in the edit box grows in size.

Method 2:
You want the edit box to show normal, grow in size when got focus.. then normal when lost focus ..
Put the code in GotFocus event. Then in Lost focus, set This.height = Whatever...
This will help avoid blocking other controls down the form...

In the above 20 is the minimum height taken and 16 as approximate height of each character. If you use difefrent fonts, you can suitably change that statement.

:)

____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
Hi Ramani,

Thanks very much for your response. When I wrote the question, I had been working on that very approach. And I ran up against the following obstacles:

VERTICAL COMPONENT - The formula you propose is thrown off if there are numerous short lines with CR's (which my fields do indeed have). So I thought of providing a correction for this by counting the OCCURS(<CR>, Table.MemoField). I then didn't pursue this further, because it looks like it's getting pretty arcane, and I hoped to find something proprietary

HORIZONTAL COMPONENT - I am unclear about your use of the n=SET(&quot;memowidth&quot;) to determine line length. If I understand correctly, the n=SET(&quot;memowidth&quot;) in your code returns the length in characters of each line.

But, because the EditBox uses an autowrap method for its &quot;lines&quot;, I haven't been setting MEMOWIDTH, leaving it at default. This appears to work well, and I have observed that when I change the width of an EditBox at design time, the wrap function continues to work just fine.

Do you think I should be setting MEMOWIDTH anyway? And if so, to what value? Or, how would I calculate that value?

My obstacle here seems to be that among all the factors in determining line length in characters, are two variable ones: 1) width of the editbox, and 2) variable character widths in proportionate fonts.

Any ideas?

I am very grateful for the thoughtful help you (and the other guys at Tek-Tips) give to us learners.

Thanks again,

BillvV
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top