Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Focus with TreeView Events
Message
De
09/12/2003 15:24:00
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Focus with TreeView Events
Divers
Thread ID:
00857371
Message ID:
00857371
Vues:
76
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
Répondre
Fil
Voir

Click here to load this message in the networking platform