Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Controlling design-time focus
Message
De
23/05/2005 13:38:09
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
23/05/2005 13:12:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01016828
Message ID:
01016836
Vues:
14
>I'm working on a sort of a builder and having one problem I can't seem to resolve.
>
>The builder form has a list of the controls on the target form. As the cursor moves through the list, I want the appropriate control selected on the target. For controls that have a SetFocus method, I can just call that, and it works. For controls with no SetFocus method, I've written code using the MOUSE command to click on the right control and then put the mouse back where I found it. This also works.
>
>However, the two don't work very well together. In some cases, when a control has been selected using MOUSE, it won't give up the focus programmatically. That is, after MOUSE CLICK highlights a particular control, subsequent calls to SetFocus don't change the highlight.
>
>I'm looking for any ideas on how to make this work. Here's the code I'm now using. oControl is an object reference to the control I want to be selected. ThisForm.oChangeForm is an object reference to the target form
>
>
>IF PEMSTATUS(oControl, "SetFocus", 5) AND NOT (PEMSTATUS(oControl,"Enabled", 5) AND oControl.Enabled = .F.)
>   oControl.SetFocus()
>ELSE
>   * Use brute force
>   * First hold current mouse pos
>   nMouseFound = AMOUSEOBJ(aMousePos, 1)
>	
>   IF PEMSTATUS(oControl, "Left", 5)
>      * Has position properties, so click it
>      * First, get position on form, not in container
>      nTop = OBJTOCLIENT(oControl, 1)
>      nLeft = OBJTOCLIENT(oControl, 2)
>      ACTIVATE WINDOW (ThisForm.oChangeform.Caption)
>      MOUSE CLICK AT nTop + 5, nLeft + 5 PIXELS WINDOW (ThisForm.oChangeform.Caption)
>      ACTIVATE WINDOW (This.Name)
>      * Reactivate this form
>      MOUSE CLICK AT This.Top + 5, This.Left + 5 PIXELS
>		
>      IF nMouseFound = 4
>         * Put mouse pointer back where it belongs.
>         DO CASE
>         CASE WEXIST(aMousePos[2].Name)
>            MOUSE AT aMousePos[4], aMousePos[3] PIXELS WINDOW (aMousePos[2].Name)
>         CASE WEXIST(aMousePos[2].Caption)
>            MOUSE AT aMousePos[4], aMousePos[3] PIXELS WINDOW (aMousePos[2].Caption)
>         OTHERWISE
>            * Can't do anything about it
>         ENDCASE
>      ENDIF
>   ENDIF
>
>ENDIF
>
>
>
>Thanks for any ideas.
>
>Tamar

Hi Tamar,
A quick untested idea. You actually already have the reference and all you want to do is to highlight it in other form, right?
If so what about creating a single temporary transparent container in other form and playing with its left,top,hegiht,width (might have say red dash border)?
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform