Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unbound Date Textbox doesn't get focus when NULL
Message
 
To
03/12/2003 07:40:20
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00855359
Message ID:
00855368
Views:
13
Hi Agnes,

thanks for the suggestion! I will test this later today and tell you if it worked. I haven't tested if it makes any difference whether the conrol is bound to a column in a cursor or to a property.

Regards,
Armin

>Hi Armin,
>
>as a workaround I would suggest (untested)
>
>
>*somewhere in (textboxes) init
>lcProp = sys(2015)
>.textbox.addproperty(lcProp,.textbox.value)
>.textbox.controlsource = 'THIS.'+lcProp
>
>
>now you have a (meaningless) controlsource and it should work.
>HTH
>
>Agnes
>>Hi,
>>
>>just wanted to ask you for your opinion on this (thinking of submitting this as a bug) ...
>>
>>If you have an unbound textbox with its format property set to "D" and you are setting the value property to NULL programmatically, you cannot get into the textbox with neither mouse usage nor tab into it. After the GotFocus() event, the Valid() is fired immediately. If the textbox is bound, everything works fine.
>>
>>Since the GotFocus() event fires, a workaround is easy: Checking for NULL in GotFocus and setting the value to {} helps. In the LostFocus event an empty date could be set back to NULL.
>>
>>Same behaviour in VFP7SP1 and VFP8SP1.
>>
>>Thanks for your input,
>>Armin
>>
>>
>>**************************************************
>>*-- Class:        test (c:\mmortals\sis\sispat\test.vcx)
>>*-- ParentClass:  form
>>*-- BaseClass:    form
>>*-- Time Stamp:   12/03/03 12:55:09 PM
>>*
>>DEFINE CLASS test AS form
>>
>>
>>	Top = 0
>>	Left = 0
>>	Height = 157
>>	Width = 289
>>	DoCreate = .T.
>>	Caption = "Form1"
>>	Name = "Form1"
>>
>>
>>	ADD OBJECT text1 AS textbox WITH ;
>>		Alignment = 3, ;
>>		Value = ({}), ;
>>		ControlSource = "test.f1", ;
>>		Format = "D", ;
>>		Height = 23, ;
>>		Left = 24, ;
>>		Top = 48, ;
>>		Width = 100, ;
>>		Name = "Text1"
>>
>>
>>	ADD OBJECT command1 AS commandbutton WITH ;
>>		Top = 96, ;
>>		Left = 24, ;
>>		Height = 27, ;
>>		Width = 84, ;
>>		Caption = "Set NULL", ;
>>		Name = "Command1"
>>
>>
>>	ADD OBJECT text2 AS textbox WITH ;
>>		Alignment = 3, ;
>>		Value = (DATE()), ;
>>		Format = "D", ;
>>		Height = 23, ;
>>		Left = 168, ;
>>		Top = 48, ;
>>		Width = 100, ;
>>		Name = "Text2"
>>
>>
>>	ADD OBJECT command2 AS commandbutton WITH ;
>>		Top = 96, ;
>>		Left = 168, ;
>>		Height = 27, ;
>>		Width = 84, ;
>>		Caption = "Set NULL", ;
>>		Name = "Command2"
>>
>>
>>	ADD OBJECT label1 AS label WITH ;
>>		AutoSize = .T., ;
>>		Caption = "Bound", ;
>>		Height = 17, ;
>>		Left = 24, ;
>>		Top = 12, ;
>>		Width = 38, ;
>>		Name = "Label1"
>>
>>
>>	ADD OBJECT label2 AS label WITH ;
>>		AutoSize = .T., ;
>>		Caption = "NOT bound", ;
>>		Height = 17, ;
>>		Left = 168, ;
>>		Top = 12, ;
>>		Width = 65, ;
>>		Name = "Label2"
>>
>>
>>	PROCEDURE Load
>>		CREATE CURSOR test (f1 D NULL)
>>		INSERT INTO test (f1) VALUES (DATE())
>>	ENDPROC
>>
>>
>>	PROCEDURE Unload
>>		USE IN SELECT("test")
>>	ENDPROC
>>
>>
>>	PROCEDURE command1.Click
>>		thisform.text1.Value = null
>>	ENDPROC
>>
>>
>>	PROCEDURE command2.Click
>>		thisform.text2.Value = null
>>	ENDPROC
>>
>>
>>ENDDEFINE
>>*
>>*-- EndDefine: test
>>**************************************************
>>

Armin Neudert
Regional Director (Stuttgart) of German FoxPro User Group dFPUG

MCP for Visual FoxPro

Expert/Editor of the VFP section in the German Codezone community portal
Previous
Reply
Map
View

Click here to load this message in the networking platform