Glutch Posted February 18, 2015 Share Posted February 18, 2015 Hello! I'm trying to figure out how to get a placeholder instead of raw text on the Koda inputs.'> $key = GUICtrlCreateInput("Keys to press (optional)", 16, 160, 145, 21) I dont want the text to stay in the box if i click inside it. I want a solution like this in html: <input type="text" placeholder="Keys to press (optional)"/> Would greatly appreciate some advice Link to comment Share on other sites More sharing options...
UEZ Posted February 18, 2015 Share Posted February 18, 2015 You can do something like this here: #Include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 300, 200) $iLabel = GUICtrlCreateLabel("Test", 10, 10) $iBtn = GUICtrlCreateButton("Exit", 200, 100, 60, 60) $key = GUICtrlCreateInput("Keys to press (optional)", 16, 160, 145, 21) ControlFocus($hGUI, "", $iLabel) GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iBtn GUIDelete() Exit EndSwitch Until False Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hGUI Switch BitAND($wParam, 0xFFFF) Case $key Switch BitShift($wParam, 16) Case $EN_KILLFOCUS If GUICtrlRead($key) = "" Then GUICtrlSetData($key, "Keys to press (optional)") Case $EN_SETFOCUS If GUICtrlRead($key) = "Keys to press (optional)" Then GUICtrlSetData($key, "") EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Glutch Posted February 18, 2015 Author Share Posted February 18, 2015 Oh... That was a tedious solution. I'll probably put a label above the input instead. Thanks for the help though! PS: Koda should implement this feature Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 18, 2015 Moderators Share Posted February 18, 2015 Glutch (and UEZ),No need to be quite so complicated - use a cuebanner: #include <GUIConstantsEX.au3> #include <EditConstants.au3> $hGui = GUICreate("", 500, 500) $cInput = GUICtrlCreateInput("", 10, 10, 200, 20) GUICtrlSendMsg($cInput, $EM_SETCUEBANNER, False, "Keys to press (optional)") $cButton = GUICtrlCreateButton("Test", 10, 100, 80, 30) GUICtrlSetState($cButton, $GUI_FOCUS) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndI hope that helps. M23 pixelsearch and Raik 2 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
UEZ Posted February 18, 2015 Share Posted February 18, 2015 Indeed, I forgot about cuebanner...Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Loc Posted February 2, 2021 Share Posted February 2, 2021 (edited) Looks like using Style $ ES_READONLY it cannot be displayed. Is there any way? @Melba23 Edited February 2, 2021 by Loc Link to comment Share on other sites More sharing options...
Nine Posted February 2, 2021 Share Posted February 2, 2021 $cInput = GUICtrlCreateInput("Text you want here", 10, 10, 200, 20, $ES_READONLY) ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 2, 2021 Moderators Share Posted February 2, 2021 MrRow, The cuebanner is designed to vanish when text is entered. If you cannot enter any text then why do you need a cuebanner? Just use a label instead. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Deathdn Posted December 29, 2023 Share Posted December 29, 2023 _GUICtrlEdit_SetCueBanner(-1, "placeholder", True) ; placeholder How about it? Skysnake 1 Link to comment Share on other sites More sharing options...
Andreik Posted December 29, 2023 Share Posted December 29, 2023 How about not grave digging old threads without adding any real value? Sending EM_SETCUEBANNER to input control has been already suggested. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now