Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fire a control on a Form you can not see?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01641455
Message ID:
01641464
Views:
60
Sorry - no time. I will take your word for it.

>>Is there anyway to not actually have a form appear (I don't want the user to see the form at all), yet have my program select a control on that form?
>>
>>AFAIK. this is not possible. Once a control on the form gets focus, the form becomes visible...
>
>I do not think that is true. Run the following and then un-comment the activate of the hidden form and run it again:
>
>
>loHiddenForm	= CREATEOBJECT('myHiddenForm')
>loMainForm		= CREATEOBJECT('myMainForm', loHiddenForm)
>
>loMainForm.Show(1)
>clear events
>
>define class myMainForm as Form
>	hiddenForm = null
>	
>	add object cmdShowActive as commandbutton with caption = "Show Active"
>	
>	function init(toHiddenForm as Form) as Boolean
>		if type('toHiddenForm.Class') = 'C' and toHiddenForm.Class = 'Myhiddenform'
>			this.hiddenForm	= toHiddenForm
>		endif
>		return .t.
>	endfunc
>	
>	procedure cmdShowActive.Click() as VOID
>		if isnull(thisform.hiddenForm)
>			messagebox('No hidden form found')
>		else
>			thisform.hiddenForm.aTextBox.SetFocus()
>			messagebox(thisform.hiddenForm.ActiveControl.Name)
>		endif
>		return null
>	endproc
>enddefine
>
>define class myHiddenForm as Form
>	add object cmdDoSomething as commandbutton with caption = "Do it"
>	add object aTextbox as textbox with value = 'my text box value'
>
>*!*		procedure Activate() as VOID
>*!*			this.Visible		= .f.
>*!*			return null
>*!*		endproc
>enddefine
>
Previous
Reply
Map
View

Click here to load this message in the networking platform