Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Focus with TreeView Events
Message
From
09/12/2003 15:24:00
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Focus with TreeView Events
Miscellaneous
Thread ID:
00857371
Message ID:
00857371
Views:
77
I'm using the FoxTray OLE Control to load a form. I'm having trouble getting giving the new form the focus. If I display a messagebox just after loading the form or in the form's init, the focus is correct. If not, the focus is somewhere else, though I've been unable to determine where.

Compile this code as an EXE to see what I mean. Any ideas? A bandaid is okay here, though I'd like to keep the form as top-level.

*** Code begins here
_Screen.AddProperty("TrayForm",CREATEOBJECT("Form"))
_Screen.TrayForm.addobject("FoxTray","DMTray")

sleep(1000)
READ EVENTS


DEFINE CLASS myform as Form
showwindow = 2

PROCEDURE Init()
thisform.AddObject("txtbox","TextBox")
thisform.txtbox.visible = .T.
thisform.txtbox.setfocus()
* Uncomment the next line and the focus works
* MESSAGEBOX("test")
ENDPROC

PROCEDURE QueryUnload
thisform.Release()
ENDPROC
ENDDEFINE

DEFINE CLASS DMTray As OLEControl
OleClass="FoxTrayCtl.cFoxTray"

PROCEDURE Init
WITH THIS
* Set the default properties
.IconTip = "Test Form"
.ShowIcon()

* Set the menu items
.GetPopupItem(1).Caption = "View Form"
.GetPopupItem(2).Caption = "Exit"
ENDWITH
ENDPROC

PROCEDURE OnPopupItemSelected(item, caption)
DO CASE
CASE item = 1
_Screen.AddProperty("testform",CREATEOBJECT("myform"))
_Screen.testform.show()
CASE item = 2
CLEAR EVENTS
ENDCASE
ENDDEFINE
Reply
Map
View

Click here to load this message in the networking platform