Jump to content

A question 'bout Focus....


Puckmeister
 Share

Recommended Posts

It would help to supply the script you have so far, so the forum user's can understand and see what you are attempting to do, otherwise it's best guess.

Gary

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

It would help to supply the script you have so far, so the forum user's can understand and see what you are attempting to do, otherwise it's best guess.

Gary

yes, i need this function for this script here Klip!

and for example here is a piece of code

#include <GUIConstants.au3>
GUICreate("How to...", 190, 40) ; will create a dialog box that when displayed is centered
    Opt("GUICoordMode",2)
    
    GUICtrlCreateButton ("Button1",  10, 10, 50)
    GUICtrlCreateButton ("Button2",  10, -1, 50)
    GUICtrlCreateButton ("Button3",  10, -1, 50)

GUISetState ()

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

its just a little problem:

if i press tab, right-arrow or down-arrow in this gui the focus moves from button 1 to button 2, then to button 3 and finally back to 1 where it starts over and over again.

my problem is that i want to miss out a button, lets say button 2, so that when focus is on button 1 and i press tab or right- or down-arrow focus moves to button 3 and NOT to button 2.

i don`t know if this is possible without Hotkeyset or _IsPressed functions but i hope someone can help me

greets, chris

Link to comment
Share on other sites

Hmmm ... Why not use a small "routine" [external function] :

; 
; Fonction :            _Enable
; Description :         Active un contrôle
; Paramètres :             $s_Ctrl1 est le contrôle a activer
; Dépendance :             Aucunes
; Valeur retournée :   Identique à GUICtrlSetState
;                       ==> 1 = succès
;                       ==> 0 = échecs
; Auteur :              Groumphy
; License :             GPL
; Version :             v1.0.226.alpha
; 
Func _Enable($s_Ctrl1)
    Return GUICtrlSetState($s_Ctrl1, $GUI_ENABLE)
    If @error Then MsgBox(0 + 32, "Error", "Error occured" & @CR _
        "Failed loading Func _Enable (" & $s_Ctrl1 & ")")
EndFunc

; 
; Fonction :            _Disable
; Description :         Désactive un contrôle
; Paramètres :             $s_Ctrl1 est le contrôle a activer
; Dépendance :             Aucunes
; Valeur retournée :   Identique à GUICtrlSetState
;                       ==> 1 = succès
;                       ==> 0 = échecs
; Auteur :              Groumphy
; License :             GPL
; Version :             v1.0.226.alpha
; 
Func _Disable($s_Ctrl2)
    Return GUICtrlSetState($s_Ctrl2, $GUI_DISABLE)
    If @error Then MsgBox(0 + 32, "Error", "Error occured" & @CR _
        "Failed loading Func _Disable (" & $s_Ctrl2 & ")")
EndFunc

For sample used on a ComboBox :

; Création de l'interface utilisateur globale permettant la récolte des renseignements
    GUICreate(_Lng($u_Lng, "s_005"), 500, 600, -1, -1, -1, -1, -1)
        GUISetState (@SW_SHOW)                      ; Affichage de l'interface utilisateur

    $s_cSocLeasing = GUICtrlCreateCombo(_Lng($u_Lng, "s_021"), 185, 28, 130, 95, $CBS_DROPDOWNLIST)
        GUICtrlSetData($s_cSocLeasing, _Lng($u_Lng, "s_022"))
        GUICtrlSetTip($s_cSocLeasing, _Lng($u_Lng, "s_024"))
    $s_iOthLeasing = GUICtrlCreateInput(_Lng($u_Lng, "s_025"), 330, 28, 150, 20, $WS_DISABLED)
        GUICtrlSetTip($s_iOthLeasing, _Lng($u_Lng, "s_026"))
While 1                                         ; Affiche l'interface utilisateur
                                                    ; tant que l'évenement n'est pas fermé.
        Dim $s_GUI
            $s_GUI = GUIGetMsg()
        If $s_GUI = $GUI_EVENT_CLOSE Or $s_GUI = $s_smExit Then ExitLoop
        Select
            Case $s_GUI = $s_cSocLeasing
                If GUICtrlRead($s_cSocLeasing) = _Lng($u_Lng, "s_029") Then 
                    _Enable($s_iOthLeasing)
                Else
                    _Disable($s_iOthLeasing)
                EndIf
        EndSelect
    Wend

Is it not more easyly for you to give an external function ?

It's the same on un button ...

;)

----------------------GroumphyMore information about me [Fr]

Link to comment
Share on other sites

you'll have to unset $WS_TABSTOP from the styles of that button

@quaizywabbit

i thought about that, but i didn`t know how to unset a style.

In the Helpfile there is no style added by default on a push-button.

i added the $BS_ICON-style to display an icon on my button. it`s the only style there.

is it really possible to set or unset $WS_TABSTOP on a button ?

if yes, plz give me an example

Hmmm ... Why not use a small "routine" [external function] :

Is it not more easyly for you to give an external function ?

It's the same on un button ...

;)

@Groumphy

thx for this, but i don`t want to disable these buttons, i just want to ignore them while using tab :P

Link to comment
Share on other sites

You can add a style to an already-defined set of styles like this:

$myNewStyles = bitOR($myOldStyles, $styleToAdd)

So you can remove a style from an already-defined set of styles like this:

$myNewStyles = bitAND($myOldStyles, bitNOT($styleToRemove))
Link to comment
Share on other sites

You can add a style to an already-defined set of styles like this:

$myNewStyles = bitOR($myOldStyles, $styleToAdd)

So you can remove a style from an already-defined set of styles like this:

$myNewStyles = bitAND($myOldStyles, bitNOT($styleToRemove))
thx for the fast answer, i tried it but it didn`t worked.

i think it is because $WS_TABSTOP doesn`t work on buttons, but i didn`t know for sure

greets, chris

Link to comment
Share on other sites

The help file notes $WS_TABSTOP as a 'forced' style for buttons. Perhaps this is the problem?

(Why is it forced?)

I would think that one would be a default style not a forced style, might want to take that up with the devs, in the idea lab

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

the problem might be that all of the original Style(s) might not have been entered in the first parameter:

BitAnd($oldstyle, BitNot($styletoremove))

and i'm not sure if guictrlsetstyle() updates the control before it returns

I've had no problems since my last revision of ANYGUI, try using _TargetStyle().....it's the last function in ANYGUI.

Edited by quaizywabbit
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
Link to comment
Share on other sites

i don`t get it, could you please show me how to unset ws_tabstop for button 2 in the following gui quaizywabbit ?

#include <GUIConstants.au3>

GUICreate("How to...", 190, 40) ; will create a dialog box that when displayed is centered

Opt("GUICoordMode",2)

GUICtrlCreateButton ("Button1", 10, 10, 50)

GUICtrlCreateButton ("Button2", 10, -1, 50)

GUICtrlCreateButton ("Button3", 10, -1, 50)

GUISetState ()

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

greets, chris

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...