Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamic Sizing of a Read-Only Editbox
Message
De
05/08/1997 18:25:45
Jp Steffen
Leadership Data Services
Des Moines, Iowa, États-Unis
 
 
À
04/08/1997 22:10:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00043003
Message ID:
00043269
Vues:
544
Paul,

I must be missing something, I don't have an autosize property or a wordwrap property on the texbox control. I am using VFP 3.0b but I don;t see those properties on VFP 5.0 either. The Label control does have those properties but there appears to be a character limit on a label control which my Text string exceeds, I did't get the autosize behavior to work on a label control either.

Do Canadians have an enhanced version of VFP?

JP


>Can you use a textbox instead of an editbox? I think you do, or at least you can fake a read-only editbox with a textbox if really want an editbox. :)
>
>So, use a textbox with Autosize = .t. and WordWrap = .t. If WordWrap is true, Autosize acts on the vertical, not on the horizontal. So, VFP will calculate the Height (you can take textbox's height!) for you and it will also display it correctly. Just tried it and it works like a charm. This is a cute feature. I didn't know it until now!
>
>Vlad
>
>>Paul,
>>
>>Using memlines is a good idea, I will try that. Can't use scroll bars - this is a wizard style interview engine that stores instruction text and control class names in a database and then instantiates both the message and the control container as the user moves from one page of the interview to the next. I never know how much depth the message box (ie text box) will need or how much vertical space the controls will need and I want to display all the text, all at once, with no blank space between the instructions and the control. So I have to make sure the edit box does not cross over on top of the controls. I want it all - Paul, I want it all! It actually works pretty good - but it could be better. Maybe MEMLINES will help. Thanks
>>
>>JP
>>
>>>Instead of looking for chr(10), use memlines() FoxPro function (works for any char variable, not only memo). You also must take care of word wrapping. Basically: the number of lines * the height of one line. Sounds easy, isn't it? I know it's not only that. :)
>>>
>>>Can't you always use the maximum available area and have scroll bars? Is it too easy/simple?
>>>
>>>>Hey!
>>>>
>>>>Does anybody have a good solution to dynamically calculating the Height property of an edit box based on the Font, Font Size, Width property and number of characters in a memo which is passed as the control source to the edit box? Here is what I have been using:
>>>>
>>>>Where 'lcMsg' is my memo string & 475 pixels is the fixed edit box width
>>>>also if there
>>>>
>>>>
>>>>lnHeight = FONTMETRIC(1,"ARIAL",10) + FONTMETRIC(4,"ARIAL",10)
>>>>lnChrWidth = LEN(lcMsg) + (.15 * LEN(lcMsg))
>>>>thisform.cEditBox1.Height = ;
>>>> ( CEILING((lnChrWidth * FONTMETRIC(6,"ARIAL",10))/475) + IIF(CHR(10) $ lcMsg,1,0) ) * lnHeight
>>>>
>>>>
>>>>* .15 X LEN(lcMsg) gives me an addtional 15% character count to compensate for string lengths on the narrow side.
>>>>* " IIF(CHR(10) $ lcMsg,1,0)" credits the string with an extra line because a CR adds only one character but a whole new line.
>>>>
>>>>Actually, this works fairly well, but as the value of len(lcMsg) goes up or if there is more that one (1) CR in the string the height property becomes more and more inaccurate. Generally my problem is the height property grows two much and inserts blank vertical space that other objects on the page could be using.
>>>>
>>>>Any Ideas?
>>>>
>>>>TIA JP
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform