Sign in to follow this  
Followers 0
hmes

Need few suggestions

5 posts in this topic

I was coping it so this may contains some spellings

1st questions

if i made function like this

$ASD = GUICtrlCreateCombo("0",190, 8,30)
    GUICtrlSetData(-1, "1|2|3|4|5|6", "")

Func _QWE()
    Send(GUICtrlRead($ASD))
EndFunc

HotKeySet("q"), "_QWE")

Then, func _qwe reads data from $ASD whenever i change it

So why this isnt working?

$ZXC = GUICtrlCreateCombo("q",260, 8,30)
    GUICtrlSetData(-1, "w|e|r|t|y|u|i|o|p", "")

$ASD = GUICtrlCreateCombo("0",190, 8,30)
    GUICtrlSetData(-1, "1|2|3|4|5|6", "")

Func _QWE()
    Send(GUICtrlRead($ASD))
EndFunc

HotKeySet(GUICtrlRead($ZXC)), "_QWE")

So why HoyKeySet reads only "q" from $ZXC, even if i change it?

2nd questions

Is it possible to 'lock' a combo? So you cant edit it like in input, you can choose only from those options that i put in it?

And last 3rd questions

I want this function to work only while its selected in menu

So i write something like this

$ASD = GUICtrlCreateCombo("0",190, 8,30)
    GUICtrlSetData(-1, "1|2|3|4|5|6", "")

Func _QWE()
    Send(GUICtrlRead($ASD))
EndFunc

Func _TYU()
send("q")
endfunc



$settings = GUICtrlCreateMenu("Settings")
$enable = GUICtrlCreateMenuItem("Enable", $settings)
    GUICtrlSetState(-1, $GUI_UNCHECKED)

While 1
    $msg = GUIGetMsg()

If $msg = $enable Then
            If BitAND(GUICtrlRead($enable), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
                GUICtrlSetState($enable, $GUI_CHECKED)
                HotKeySet("q", "_QWE")
                
            Else
                GUICtrlSetState($enableRSB, $GUI_UNCHECKED)
                                HotKeySet("q", "_TYU")
                
            EndIf
        EndIf

But its working only once, and then its disabling Q

Any suggestions?

Share this post


Link to post
Share on other sites



hmes,

Please try and post completed code - it gets annoying to have to add lots of extra lines to get something to debug! :)

I have used a label for the HotKey to action rather than using Send as I was not sure what you were Sending to! ;)

Answers 1 & 2 combined:

#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

$ZXC = GUICtrlCreateCombo("q", 260, 8, 40, 15, $CBS_DROPDOWNLIST) ; Cannot write in combo edit
GUICtrlSetData(-1, "w|e|r|t|y|u|i|o|p", "")

$ASD = GUICtrlCreateCombo("0", 190, 8, 40, 15, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "1|2|3|4|5|6", "")

$hLabel = GUICtrlCreateLabel("", 10, 10, 50, 20)

GUISetState()

; Use for comparison
$LastZXC = ""

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ZXC
            ; Clear label
            GUICtrlSetData($hLabel, "")
            ; read HotKey combo
            $CurrZXC = GUICtrlRead($ZXC)
            ; If it has changed
            If $CurrZXC <> $LastZXC Then
                ; Unset current hotkey
                HotKeySet($LastZXC)
                ; Set new hotkey
                HotKeySet($CurrZXC, "_QWE")
                ; Reset comparison
                $LastZXC = $CurrZXC
            EndIf
    EndSwitch

WEnd

Func _QWE()
    GUICtrlSetData($hLabel, GUICtrlRead($ASD) & @CRLF)
EndFunc   ;==>_QWE

Answer 3:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$settings = GUICtrlCreateMenu("Settings")
$enable = GUICtrlCreateMenuItem("Enable", $settings)
GUICtrlSetState(-1, $GUI_UNCHECKED)

$ASD = GUICtrlCreateCombo("0", 190, 8, 30)
GUICtrlSetData(-1, "1|2|3|4|5|6", "")

$hLabel = GUICtrlCreateLabel("", 10, 10, 50, 20)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $enable

            If BitAND(GUICtrlRead($enable), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
                GUICtrlSetState($enable, $GUI_CHECKED)
                HotKeySet("q", "_QWE")
            Else
                GUICtrlSetState($enable, $GUI_UNCHECKED)
                HotKeySet("q", "_TYU")
            EndIf
    EndSwitch

WEnd

Func _QWE()
    GUICtrlSetData($hLabel, GUICtrlRead($ASD) & @CRLF)
    Sleep(1000)
    ; Clear label
    GUICtrlSetData($hLabel, "")
EndFunc   ;==>_QWE

Func _TYU()
    GUICtrlSetData($hLabel, "q" & @CRLF)
    Sleep(1000)
    ; Clear label
    GUICtrlSetData($hLabel, "")
EndFunc   ;==>_TYU

I have commented liberally, but please ask if you have any questions. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Please try and post completed code - it gets annoying to have to add lots of extra lines to get something to debug! ;)

Not forgetting that the problem might be in the left out parts.

But "completed code" ... Better is something like a slimmed down "working code" example/test thats still giving you the problem.


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

MvGulik,

You are quite correct - bad choice of words on my part. Blame it on advanced years - I do! ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Yay, fast and great reply, thanks

And yea, next time i will post a working code : )

Share this post


Link to post
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
Sign in to follow this  
Followers 0