Jump to content

TwoCanoe

Active Members
  • Posts

    28
  • Joined

  • Last visited

Community Answers

  1. TwoCanoe's post in Input box with up\down control but using hex as the input was marked as the answer   
    Good catch. Nearly, not a dot but a comma.
    #include <GUIConstantsEx.au3> #include <EditConstants.au3> Local $sMyHex = "FFFFFF" $hGUI = GUICreate("Test", 500, 500) $cInput = GUICtrlCreateInput($sMyHex, 10, 100, 100, 20, $ES_CENTER) $cDummyInput = GUICtrlCreateInput(Number("0x" & $sMyHex), 110, 100, 100, 20) $cUpDown = GUICtrlCreateUpdown($cDummyInput) GUICtrlSetLimit($cUpDown, 16777215, 0) ; Set range for valid 6-digit hex values (0 to FFFFFF) GUICtrlSetState($cDummyInput, $GUI_FOCUS) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cDummyInput ; Remove the dot Local $iDecimalValue = Number(StringReplace(GUICtrlRead($cDummyInput), ",", "")) ; CHANGED HERE Local $sHexValue = Hex($iDecimalValue, 6) ; Convert to 6-digit hex GUICtrlSetData($cInput, $sHexValue) EndSwitch WEnd Many thanks ioa747
×
×
  • Create New...