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:
01641459
Views:
56
>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
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform