GUICtrlSendMsg & GUICtrlCreateCombo

  • Ich fass mich mal kurz:

    Ich brauche Hilfe bei GUICtrlSendMsg.
    Und zwar will ich das

    [autoit]


    $PressedKey = GUICtrlCreateCombo("", 104, 16, 105, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE))
    GUICtrlSetData(-1, "M1|M2|M3|Shift|CTRL|W|A|S|D|Up|Down|Left|Right|Combo WASD|Combo ARROW")

    [/autoit]


    genauso funktioniert wie

    [autoit]


    $Time = GUICtrlCreateInput("", 16, 16, 65, 24, BitOR($ES_CENTER, $ES_NUMBER))
    GUICtrlSendMsg($Time, 0x1501, 0, "Zeitwert")

    [/autoit]

    also quasi.
    In der Combobox soll sowas wie "Set Key" oder so stehen.
    Bis man mit der Maus reinklickt.
    Wenn man nichts ausgewählt hat.. soll das "Set Key" wieder automatisch erscheinen.
    Bis jetzt konnte ich einfach nichts dazu finden.
    Auch in der Shoutbox konnte mir niemand helfen..
    daher wurde mir geraten ein Thread aufzumachen.

    und nein:

    [autoit]


    $PressedKey = GUICtrlCreateCombo("", 104, 16, 105, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE))
    GUICtrlSetData(-1, "M1|M2|M3|Shift|CTRL|W|A|S|D|Up|Down|Left|Right|Combo WASD|Combo ARROW", "Key")

    [/autoit]


    kommt nicht in frage.

    Ich hoffe irgendjemand weiß wie ich das hinbekomme.

    Wer Rechtschreibfehler findet darf sie behalten. :D

  • Vielleicht funktioniert EM_SETCUEBANNER einfach nicht mit Combos.

    Edit: Ok, eigentlich hätte ich wissen müssen, dass das nur für Inputs und Edits gilt. Naja, wieder was gelernt. :D

  • Ja ich bin auch schon am überlegen ob es das ist..
    wäre ja echt schade..

    aber ich hoffe noch auf die lösung von einem Genie ... :p
    treiben sich ja ein paar davon rum hier..
    hab ich gehört :whistling:

    Wer Rechtschreibfehler findet darf sie behalten. :D

  • so habe auf die schnelle in 10 min was zusammen geschrieben. Ist nicht perfekt und kann evtl. noch Fehler enthalten. Sollte aber das machen was du vor hattest.

    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Include <GuiButton.au3>

    [/autoit][autoit][/autoit][autoit]

    Local $textfeld2active = 0
    Local $textfeld1active = 0

    [/autoit][autoit][/autoit][autoit]

    Local $form = GUICreate("test",310,61,-1,-1,-1,-1)
    Local $textfeld2 = GUICtrlCreateInput("dein Text hier....",30,20,94,20,-1,512)
    Local $textfeld1 = GUICtrlCreateInput("dein Text hier....",150,20,94,20,-1,512)
    GUICtrlSetColor($textfeld1,"0xC0C0C0")
    GUICtrlSetColor($textfeld2,"0xC0C0C0")
    GUISetState(@SW_SHOW,$form)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    While 1
    $a = ControlGetFocus ($form)
    $msg = GUIGetMsg()

    if $msg = $GUI_EVENT_CLOSE then exit

    if $a = "Edit1" Then
    if $textfeld2active = 1 then ContinueLoop
    GUICtrlSetData($textfeld2, "")
    GUICtrlSetColor ($textfeld2, "0x000000")
    $textfeld2active = 1
    else
    GUICtrlSetData($textfeld2, "dein Text hier....")
    GUICtrlSetColor($textfeld2,"0xC0C0C0")
    $textfeld2active = 0
    EndIf

    if $a = "Edit2" Then
    if $textfeld1active = 1 then ContinueLoop
    GUICtrlSetData($textfeld1, "")
    GUICtrlSetColor ($textfeld1, "0x000000")
    $textfeld1active = 1
    else
    GUICtrlSetData($textfeld1, "dein Text hier....")
    GUICtrlSetColor($textfeld1,"0xC0C0C0")
    $textfeld1active = 0
    EndIf
    sleep(10)
    WEnd

    [/autoit]
  • Das aber schon echt n großer aufwand für das kleine ergebniss..
    ich glaub dann spar ich mir das <_<

    // EDIT:
    Aber vllt brauch ich das mal für ein etwas wichtigeres projekt ..
    ich werds aufjedenfall im hinterkopf behalten das es diese möglichkeit so gibt.
    Danke ;)

    Wer Rechtschreibfehler findet darf sie behalten. :D

  • Er sollte schon CB_SETCUEBANNER nehmen, da es ja eine ComboBox ist.

    Oder einfach _GUICtrlComboBox_SetCueBanner :rofl:

  • Ich fragte mich auch, warum du in deinem Super-Beispiel Inputs genommen hast. Wahrscheinlich hast du seinen Thread nicht ganz gelesen.


  • Versuch mal 0x1703 ;)

    WTF...
    d... das isses.. 8|
    D... Danke... :huh:

    Jetzt bist du mir aber ne erklärung schuldig mein freund..
    wieso genau diese Zahl?
    und woher hast du sie?
    ..
    das muss jetzt geklärt werden bis ichs verstanden habe :D

    Wer Rechtschreibfehler findet darf sie behalten. :D

  • $EM_SETCUEBANNER ist nur für Inputs und Edits. Deswegen auch das EM davor.
    Der Wert steht u.a. in der ComboConstants.au3 und du findest ihn auch über Google, wenn du mit 'combo setcuebanner' suchst.

    Aber du kannst auch die UDF verwenden.

    Spoiler anzeigen
    [autoit]


    Global Const $CBM_FIRST = 0x1700
    Global Const $CB_SETCUEBANNER = ($CBM_FIRST + 3)

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GUICtrlComboBox_SetCueBanner
    ; Description ...: Sets the cue banner text that is displayed for the edit control of a combo box
    ; Syntax.........: _GUICtrlComboBox_SetCueBanner($hWnd, $sText)
    ; Parameters ....: $hWnd - Handle to control
    ; $sText - String that contains the text
    ; Return values .: Success - True
    ; Failure - False
    ; Author ........: Gary Frost (gafrost)
    ; Modified.......:
    ; Remarks .......: The cue banner is text that is displayed in the edit control of a combo box when there is no selection
    ;+
    ; Minimum Operating Systems: Windows Vista
    ; Related .......: _GUICtrlComboBox_GetCueBanner
    ; Link ..........:
    ; Example .......: Yes
    ; ===============================================================================================================================
    Func _GUICtrlComboBox_SetCueBanner($hWnd, $sText)
    If $Debug_CB Then __UDF_ValidateClassName($hWnd, $__COMBOBOXCONSTANT_ClassName)
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)

    [/autoit] [autoit][/autoit] [autoit]

    Local $tText = _WinAPI_MultiByteToWideChar($sText)

    [/autoit] [autoit][/autoit] [autoit]

    Return _SendMessage($hWnd, $CB_SETCUEBANNER, 0, $tText, 0, "wparam", "struct*") = 1
    EndFunc ;==>_GUICtrlComboBox_SetCueBanner

    [/autoit]


    Wenn ich eine bestimmte Funktion für ein Control suche, schaue ich zuerst in die Hilfe, dann such ich über Google auf autoit.de und autoitscript.com. Wenn ich immernochnichts finde, schaue ich allgemein über Google und dann erst stell ich einen Thread hier.