bogQ Posted September 2, 2011 Share Posted September 2, 2011 So im interested at example555@hotmail.com gray text thet will hide if field isnt emptu im not interested in scripting it (that i can do my self but effect will probably not b identical) im interested if there is easyer way-something i miss in help file like style that will work for it, or some other control that will replicate similar behavior (or control over control). TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
UEZ Posted September 2, 2011 Share Posted September 2, 2011 Something like that? #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 230, 230, -1, -1, $WS_TABSTOP) GUISetBkColor(0xFFFFFF) $idCombo = GUICtrlCreateCombo("Example555@hotmail.com", 8, 8, 209, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) $idInput = GUICtrlCreateInput("Enter your password", 8, 40, 209, 23) GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd 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...
bogQ Posted September 2, 2011 Author Share Posted September 2, 2011 no, :/gray text that will hide if field isnt emptuon MSN you can't select gray text and you can't tupe in it, but it will disapier if Input field inst empty, its like some info tip that stands inside Input it self when there inst any data in that Input. TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
hannes08 Posted September 2, 2011 Share Posted September 2, 2011 You'll need to check whether the input field has the current focus, if it has, you can set the field contents to empty and the color to black. If it looses focus check, whether it's empty and reassign the grey example. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
ahmet Posted September 2, 2011 Share Posted September 2, 2011 Look at MSDN for EM_SETCUEBANNER and CB_SETCUEBANNER. Link to comment Share on other sites More sharing options...
guinness Posted September 2, 2011 Share Posted September 2, 2011 (edited) So this is using UEZ's initial example but I've added the option of when a user selects the combo or inputbox it will delete the data & if you don't add any data then it will revert back to the previous text! expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <ComboConstants.au3> #include <EditConstants.au3> #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global $__ControlID, $__PreviousText _Main() Func _Main() Local $hGUI $hGUI = GUICreate("Example by guinness 2011", 230, 230, -1, -1) GUISetBkColor(0xFFFFFF) GUICtrlCreateCombo("Example555@hotmail.com", 8, 8, 209, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) GUICtrlCreateInput("Enter your password", 8, 40, 209, 23) GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) GUICtrlSetState(-1, $GUI_FOCUS) GUIRegisterMsg($WM_COMMAND, 'WM_CHECK') GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>_Main Func WM_CHECK($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $ilParam Local $hHandle, $iCode $hHandle = GUICtrlGetHandle($__ControlID) $iCode = _WinAPI_HiWord($iwParam) Switch $iCode Case $EN_SETFOCUS, $CBN_SETFOCUS $__ControlID = _WinAPI_LoWord($iwParam) $__PreviousText = GUICtrlRead($__ControlID) GUICtrlSetData($__ControlID, "") Case $EN_KILLFOCUS, $CBN_KILLFOCUS If _WinAPI_GetClassName($hHandle) = "ComboBox" Then _GUICtrlComboBox_SetEditText($hHandle, $__PreviousText) Else If GUICtrlRead($__ControlID) = "" Then GUICtrlSetData($__ControlID, $__PreviousText) EndIf EndIf EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_CHECK Edited September 2, 2011 by guinness FaridAgl and KeyOne 2 UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
bogQ Posted September 2, 2011 Author Share Posted September 2, 2011 (edited) ty ahmet Edited September 2, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
UEZ Posted September 2, 2011 Share Posted September 2, 2011 Here my version: expandcollapse popup#include <ComboConstants.au3> #include <EditConstants.au3> #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 230, 230, -1, -1, $WS_TABSTOP) GUISetBkColor(0xFFFFFF) $idCombo = GUICtrlCreateCombo("Example555@hotmail.com", 8, 8, 209, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) $hCombo = GUICtrlGetHandle($idCombo) $idInput = GUICtrlCreateInput("Enter your password", 8, 40, 209, 23, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) $hInput = GUICtrlGetHandle($idInput) $idButton = GUICtrlCreateButton("Exit", 194, 170) Global $DefaultPassChar = GUICtrlSendMsg($idInput, $EM_GETPASSWORDCHAR, 0, 0) GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, 0, 0) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "Check") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $idButton Exit EndSwitch WEnd Func Check($hWnd, $iMsg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAND($wParam, 0x0000FFFF) Switch $nNotifyCode Case 256, 3 ;set focus Switch $nID Case $idCombo If _GUICtrlComboBox_GetEditText($hCombo) = "Example555@hotmail.com" Then _GUICtrlComboBox_SetEditText($hCombo, "") Case $idInput If GUICtrlRead($idInput) = "Enter your password" Then GUICtrlSetData($idInput, "") GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, $DefaultPassChar, 0) EndIf EndSwitch Case 512, 4 ;kill focus If GUICtrlRead($idInput) = "" Then GUICtrlSetData($idInput, "Enter your password") GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, 0, 0) EndIf If GUICtrlRead($idCombo) = "" Then _GUICtrlComboBox_SetEditText($hCombo, "Example555@hotmail.com") EndSwitch Return "GUI_RUNDEFMSG" EndFunc Br, UEZ KeyOne 1 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...
bogQ Posted September 2, 2011 Author Share Posted September 2, 2011 (edited) thats why i tolded that i whud not like to hard code it, i need around 30 fields with that gray thing i think that code from rover is easyer #include <GUIConstantsEX.au3> #include <EditConstants.au3> #include <WinAPI.au3> $hGui = GUICreate("Subclassed edit controls /w custom tooltips and cue banners from rover", 500, 300) GUICtrlCreateLabel("Info", 10, 5) $Input1 = GUICtrlCreateInput("", 10, 20, 140, 20) $Input2 = GUICtrlCreateInput("", 10, 40, 140, 20) $Input3 = GUICtrlCreateInput("", 10, 60, 140, 20) $Input4 = GUICtrlCreateInput("", 10, 80, 140, 20) $Input5 = GUICtrlCreateInput("", 10, 100, 140, 20) $Input6 = GUICtrlCreateInput("", 10, 120, 140, 20) _GUICtrlEdit_SetCueBanner($Input1, "Name") _GUICtrlEdit_SetCueBanner($Input2, "Adress") _GUICtrlEdit_SetCueBanner($Input3, "Nome Phone") _GUICtrlEdit_SetCueBanner($Input4, "Mobile Phone") _GUICtrlEdit_SetCueBanner($Input5, "Date of birth") _GUICtrlEdit_SetCueBanner($Input6, "Town") GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd Func _GUICtrlEdit_SetCueBanner($hWnd, $sText) Local $tText = _WinAPI_MultiByteToWideChar($sText) _SendMessage(GUICtrlGetHandle($hWnd), $EM_SETCUEBANNER, False, DllStructGetPtr($tText)) EndFunc never the less t u all for suggestions Edited September 2, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
JiBe Posted September 2, 2011 Share Posted September 2, 2011 Hi, Here my version: ;#include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #Include <WinAPI.au3> #Include <GuiComboBox.au3> $hGUI = GUICreate("Test", 230, 230, -1, -1, $WS_TABSTOP) GUISetBkColor(0xFFFFFF) $idCombo = GUICtrlCreateCombo("", 8, 8, 209, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) SetCueText($idCombo, "Example555@hotmail.com") GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) $idInput = GUICtrlCreateInput("", 8, 40, 209, 23) SetCueText($idInput, "Enter your password") GUICtrlSetFont(-1, 9, 400, 2, "Arial") GUICtrlSetColor(-1, 0x808080) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func SetCueText($control, $text, $wParam = False) $hWnd = GUICtrlGetHandle($control) if (_WinAPI_GetClassName($hWnd)='ComboBox') Then _GUICtrlComboBox_SetCueBanner($hWnd, $text) else If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) $text = _WinAPI_MultiByteToWideChar($text) Return _SendMessage($hWnd, $EM_SETCUEBANNER, $wParam, DllStructGetPtr($text)) = 1; EndIf EndFunc Jeanphile KeyOne 1 Link to comment Share on other sites More sharing options...
rover Posted September 2, 2011 Share Posted September 2, 2011 @bogQ MultiByteToWideChar is no longer needed.#include <GUIConstantsEX.au3> #include <EditConstants.au3> #include <WinAPI.au3> $hGui = GUICreate("", 500, 300) GUICtrlCreateLabel("Info", 10, 5) Local $aInput[6][2] = [[0, "Name"],[0, "Address"],[0, "Home Phone"],[0, "Mobile Phone"],[0, "Date of birth"],[0, "Town"]] For $i = 0 To UBound($aInput) -1 $aInput[$i][0] = GUICtrlCreateInput("", 10, (20*($i+1)), 140, 20) GUICtrlSendMsg(-1, $EM_SETCUEBANNER, True, $aInput[$i][1]) Next GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd ;Does not work for edit controls with $ES_MULTILINE style. ;In XP, the banner disappears when the edit has focus (cursor in edit) ;In Vista/7 the banner can optionally still appear when the edit has focus (cursor in edit) ;(third parameter = True/False) The original function was coded in 2008 for an Ansi version of AutoIt. KeyOne and bogQ 2 I see fascists... Link to comment Share on other sites More sharing options...
UEZ Posted September 2, 2011 Share Posted September 2, 2011 Cool, $EM_SETCUEBANNER supports also $ES_PASSWORD. 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...
JiBe Posted September 3, 2011 Share Posted September 3, 2011 @bogQ MultiByteToWideChar is no longer needed.#include <GUIConstantsEX.au3> #include <EditConstants.au3> #include <WinAPI.au3> $hGui = GUICreate("", 500, 300) GUICtrlCreateLabel("Info", 10, 5) Local $aInput[6][2] = [[0, "Name"],[0, "Address"],[0, "Home Phone"],[0, "Mobile Phone"],[0, "Date of birth"],[0, "Town"]] For $i = 0 To UBound($aInput) -1 $aInput[$i][0] = GUICtrlCreateInput("", 10, (20*($i+1)), 140, 20) GUICtrlSendMsg(-1, $EM_SETCUEBANNER, True, $aInput[$i][1]) Next GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd ;Does not work for edit controls with $ES_MULTILINE style. ;In XP, the banner disappears when the edit has focus (cursor in edit) ;In Vista/7 the banner can optionally still appear when the edit has focus (cursor in edit) ;(third parameter = True/False) The original function was coded in 2008 for an Ansi version of AutoIt. yes, but it works excuse my English, I'm french JeanPhile Link to comment Share on other sites More sharing options...
bogQ Posted September 4, 2011 Author Share Posted September 4, 2011 anyone have the clue why something like that won't work under some XP computers? My work comp XP sp 2 working. home comps XP sp3 and sp2 not working If @error isnt detected. TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
rover Posted September 6, 2011 Share Posted September 6, 2011 (edited) yes, but it worksI assume you are referring to the use of _WinAPI_MultiByteToWideChar()?If using a pre-unicode version of AutoIt, then yes it works, and is required.In a unicode version of AutoIt, it is not necessary. anyone have the clue why something like that won't work under some XP computers?My work comp XP sp 2 working. home comps XP sp3 and sp2 not workingIf @error isnt detected. When you say it won't work with some XP computers,are you referring to EM_SETCUEBANNER with ES_PASSWORD? (thanks UEZ).or do you mean the stripped down version with GUICtrlSendMsg(), the version with MultiByteToWideChar(), or both? Are you running a script with a unicode version of AutoIt on those machines? The only other issue I came across when coding the udfs other than unicode, was a problem with Asian language support in XP (not an issue in Vista/Win 7).apparently installing Asian language support disables the cue banner.In that case, you have to use the WM_COMMAND with EN_KILLFOCUS/EN_SETFOCUS notifications method SIAO had some comments on this (possibly the forums Siao?)EM_SETCUEBANNER vs. international support in XP and Server 2003https://blogs.msdn.com/michkap/archive/2006/02/25/538735.aspx I have used this on XP x86 SP2/SP3 and Vista machines (tested in english only) Edited September 6, 2011 by rover I see fascists... Link to comment Share on other sites More sharing options...
bogQ Posted September 10, 2011 Author Share Posted September 10, 2011 (edited) mucha gracias amigo your correct, problem appeared because of 10MB supplemental language support in regional and language options for right-to-left languages (including Thai) Edited September 10, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. 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