General information
Category:
Forms & Form designer
Title:
Problem with Short Editboxes
I have an editbox that gets resized (height only) based on the amount of text it is going to contain. When the editbox is quite short, it displays text strangely - the alignment gets thrown off and you can select & drag the text and it will scroll sideways out of the editbox.
It seems that the problem happens when the editbox shorter than 2 full lines of text. I can probably just swap in a textbox for these cases, but I'm wondering if this is a known issue with editboxes and if there's a workaround.
I'm getting this behaviour in VFP 7 and the 8 beta. Here's an example:
[PRE]
oForm = CreateObject("MyForm")
oForm.Show()
******************************************
DEFINE CLASS MyForm AS Form
Width = 550
Height = 170
Caption = "Edit Boxes"
WindowType = 1
ADD OBJECT edt1 AS EditBox ;
WITH Top = 25, ;
Left = 25, ;
Width = 150, ;
Height = 70, ;
Alignment = 0, ;
Value = "Some Text", ;
FontSize = 16
ADD OBJECT edt2 AS EditBox ;
WITH Top = 25, ;
Left = 200, ;
Width = 150, ;
Height = 70, ;
Alignment = 1, ;
Value = "Some Text", ;
FontSize = 16
ADD OBJECT edt3 AS EditBox ;
WITH Top = 25, ;
Left = 375, ;
Width = 150, ;
Height = 70, ;
Alignment = 2, ;
Value = "Some Text", ;
FontSize = 16
ADD OBJECT cmdStart as CommandButton ;
WITH Top = 125, ;
Left = 150, ;
Height = 25, ;
Width = 100, ;
Caption = "Start"
ADD OBJECT cmdStop as CommandButton ;
WITH Top = 125, ;
Left = 300, ;
Height = 25, ;
Width = 100, ;
Caption = "Stop"
ADD OBJECT tmr1 AS Timer ;
WITH Interval = 0
PROCEDURE cmdStart.Click
THISFORM.edt1.Height = 70
THISFORM.edt2.Height = 70
THISFORM.edt3.Height = 70
THISFORM.tmr1.Interval = 100
ENDPROC
PROCEDURE cmdStop.Click
THISFORM.tmr1.Interval = 0
ENDPROC
PROCEDURE tmr1.Timer
THISFORM.edt1.Height = THISFORM.edt1.Height - 1
THISFORM.edt2.Height = THISFORM.edt2.Height - 1
THISFORM.edt3.Height = THISFORM.edt3.Height - 1
ENDPROC
ENDDEFINE
[/PRE]
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only