Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test for longest row of text file
Message
 
 
To
21/11/2009 22:55:30
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01435894
Message ID:
01436022
Views:
78
This message has been marked as a message which has helped to the initial question of the thread.
Karen,

Simply set EditBox width/height in run-time, e.g. right after oFrm= createOBJECT("classRooms")

So, it would be
LOCAL oFrm
oFrm= createOBJECT("classRooms")
oFrm.Top = 24
oFrm.left = 1420-meslen && will keep right border assuming 1440 screen width
oFrm.Height = 573
oFrm.Width = meslen

oForm.Edit1.Width = meslen-5
You don't need to clear class for your case.


>Hi Al
>i have used your test for length in the following editbox program. The problem i have encountered is that when i introduce another text file say named "00s00mm.txt' the form itself changing according to your program - however the inner box (edit1) remains the same despite the new parameters for length. I think this is because the object is not removed from memory - do you happen to know how i can refresh the
>'ADD OBJECT Edit1 AS EditBox WITH' so it responds to the new length numbers - thanks so much for help - almost there.
>
>apologies to all for the cross over with my previous thread (clear memory from class).
>k
>mes = '00c00mm.TXT' &&& this text is variable otheres have variable widths
>
>lnmaxlength =0
>DO LENTEST && test length of text file (Al Doman's program)
>
>MESLEN = lnmaxlength
>meslen= (meslen*7.2)+18 &&&(convets character to pixels + window screen size)
>
>

>
>
>****** oFrm.desktop = .t. moved to class definition
>
>oFrm.edit1.value = filetostr(mes) 
>
>
>oFrm.Show(1)
>
>
>
>************************************
>DEFINE CLASS classrooms AS Form
> 
>
> ADD OBJECT Edit1 AS EditBox WITH ;
>        FontSize = 8, ;
>	    FontStyle = 'n', ;
>		Height= 550, ;
>		Left= 2, ;
>		fontname='lucida console', ;
>		ReadOnly= .t., ;
>		TabIndex= 2, ;
>		Top= 2, ;
>		Width= meslen-5, ;
>		Value= ""
> desktop = .t. &&& moved from setting oFrm
>ENDDEFINE
>
>
>Public Event MouseWheel As MouseWheelEventHandler
>
>PROCEDURE Object.MouseWheel
>LPARAMETERS nDirection, nShift, nXCoord, nYCoord
>
>
>PROCEDURE edit1.MouseWheel
> LPARAMETERS nDirection, nShift, nXCoord, nYCoord
>
> * Set focus to this control
> If Type("thisform.ActiveControl") # "O" or thisform.ActiveControl < >  this
> this.SetFocus
> EndIf
> 
> ENDPROC
>
>Object.RemoveObject(edit1)
>oFrm.hide(1) 
>
>
>PROC LENTEST
>CREATE CURSOR LengthTest ;
>	( LineChars C( 254 ) )
>APPEND FROM &MES TYPE SDF
>CALCULATE MAX( LEN( TRIM( LengthTest.LineChars ) ) ) TO lnMaxLength
>USE IN LengthTest
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform