String mit Sonderzeichen "&" in GUICtrlCreateLabel wie formatieren?

  • Wie im Bild ersichtlich wird das &-Zeichen zu einem _ (Unterstrich) unter den nächsten Buchstaben.
    Wie kommt das und wie behebe ich das?

    [Blockierte Grafik: http://t.imgbox.com/acs4IwD4.jpg]

    Test code
    [autoit]

    #include <GUIConstantsEx.au3>

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

    Example()

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

    Func Example()
    Local $widthCell, $msg, $iOldOpt

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

    GUICreate("My GUI") ; will create a dialog box that when displayed is centered

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

    GUISetHelp("notepad.exe") ; will run notepad if F1 is typed
    $iOldOpt = Opt("GUICoordMode", 2)

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

    $widthCell = 70
    GUICtrlCreateLabel("XXXXX&XXXXX", 10, 30, $widthCell) ; first cell 70 width
    GUICtrlCreateLabel("XXXXX&&XXXXX", 10, 30, $widthCell) ; first cell 70 width
    GUICtrlCreateLabel("XXXXX&&&XXXXX", 10, 30, $widthCell) ; first cell 70 width

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

    GUISetState() ; will display an empty dialog box

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

    ; Run the GUI until the dialog is closed
    Do
    $msg = GUIGetMsg()
    Until $msg = $GUI_EVENT_CLOSE

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

    $iOldOpt = Opt("GUICoordMode", $iOldOpt)
    EndFunc ;==>Example

    [/autoit]

    Einmal editiert, zuletzt von BiNu (24. Februar 2013 um 15:16)

  • So ? ;)

    [autoit]


    #region ### START Koda GUI section ###
    GUICreate("Kaufm. Und", 250, 250, 361)
    ;i & als Schriftzeichen
    $Label = GUICtrlCreateLabel("Friendly && Fire", 10, 50, 75, 20)
    ;i & mit Tastenkombi "Alt+S" die Aktion auslösen
    $Button = GUICtrlCreateButton("&Set Settings", 11, 100, 75, 25)
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###

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

    While True
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case -3 ;$GUI_EVENT_CLOSE
    ExitLoop
    Case $Button
    $var = "Friendly "
    $var &= "Fire "
    ;i ...und auch hier.
    MsgBox(64, "Strings addiert", $var & @TAB)
    EndSwitch
    WEnd
    ; Ende

    [/autoit]
  • Zitat


    BugFix: Lösung: Maskieren "&&" ergibt im Label "&" ;)

    BugFix: in Controls wird nur das "&" maskiert, da anderenfalls damit der Folgebuchstabe bei Druck auf <Alt> unterstrichen zur Auswahl gestellt wird

    [autoit]

    StringReplace($string,"&","&&"))

    [/autoit]

    :thumbup: