TheDcoder

Semi-transparent default text for a input box

10 posts in this topic

Hello! :), I was wondering if something like this:

dc65e5608706c73101aba853d9c8e541.png

is possible to in AutoIt? The search text will disappear ASA the user types a letter in the input box... Is it possible? How? Here is some code for you to work on:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 393, 130, 192, 124)
$Input1 = GUICtrlCreateInput("", 88, 48, 209, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Thanks in Advance, TD :)

 

P.S ASA = As soon as

Are you wondering about the image which I provided above? I made it with a very careful forgery :P


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

_GUICtrlEdit_SetCueBanner() :)

Edited by ahmet
1 person likes this

Share this post


Link to post
Share on other sites

I have avoided this function only because of it's name. I don't know what cue banner means.


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites

Thanks alot @ahmet! :D, This code works for me:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIEdit.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 393, 130, 192, 124)
$Input1 = GUICtrlCreateInput("", 88, 48, 209, 21)

_GUICtrlEdit_SetCueBanner($Input1, "Semi-transparent text AKA Cue Banner!!!", True)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

TD :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Anddddddd without a func if someone want:

GUICtrlSendMsg(-1, 0x1501, 0, "Username")

Well, i learned something when help!! xD

If you change 0 to 1 in code above the gray text not disappear when are focused (very interesting)

Edited by GordonFreeman

Share this post


Link to post
Share on other sites

@GordonFreeman Did you try it? it does not work for me :P


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Yeah, i just put this code below a input control and it works nice!

Windows 7 - SP1 - 32 Bits

 

CUEBANNER.jpg

 

I have a folder called examples were i save au3 of these little tricks.Sooner or later we always need xD

Edited by GordonFreeman

Share this post


Link to post
Share on other sites

I guess the "bit" is the problem, I am using 64-bit Win 8.1 :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

@GordonFreeman value 0x1501 equals the message EM_SETCUEBANNER, and the parameters are explained here. You can also look at the implementation of _GUICtrlEdit_SetCueBanner :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • cookiemonster
      By cookiemonster
      Hi all,
      So ive had a form for a while now, which the input boxes don't always display correctly, easiest way is to show you so plz see example.png
      As you can see all the input boxes except for the third column are not showing correctly, if I hover my mouse over them they then do, which is what I did for the boxes in the third row for the example.
      Anyone got any idea of the cause and the fix?

    • Dlund
      By Dlund
      Hey all, I'm working on a script to read in values and write them to an array which increases with size as values are added from a GUI three at a time.

      at this time, I have the following script.
       
      #include <GUIConstantsEx.au3> #include <Array.au3> main() Func saveData($arr, $newData) If IsArray($arr) = 1 Then $Bound = UBound($arr) ReDim $arr[$Bound+1] $arr[$Bound] = $newData Else Dim $arr[1] $arr[0] = $newData EndIf ; _ArrayDisplay($arr) Return $arr EndFunc Func main() dim $arr1; $oForm1 = GUICreate("Form1", 623, 226, 192, 114) $Input1 = GUICtrlCreateInput("X Value", 8, 8, 177, 21) $Input2 = GUICtrlCreateInput("Y Value", 264, 8, 129, 21) $Input3 = GUICtrlCreateInput("Z Value", 496, 8, 121, 21) $Button1 = GUICtrlCreateButton("Save and Continue", 8, 187, 137, 16) $Button2 = GUICtrlCreateButton("Save and Print", 152, 187, 145, 16) $Button3 = GUICtrlCreateButton("Cancel and Print", 304, 187, 137, 16) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $arr1 = saveData($arr1, $Input1) $arr1 = saveData($arr1, $Input2) $arr1 = saveData($arr1, $Input3); GUICtrlSetData($Input1, "Newer X") GUICtrlSetData($Input2, "Newer Y") GUICtrlSetData($Input3, "Newer Z") Case $Button2 $arr1 = saveData($arr1, $Input1) $arr1 = saveData($arr1, $Input2) $arr1 = saveData($arr1, $Input3); _ArrayDisplay($arr1) Exit Case $Button3 _ArrayDisplay($arr1) Exit EndSwitch WEnd EndFunc The array successfully increases in size, but when called in the groups of three it is always storing the values: 3,4, and then 5.  Even if the default text is left as is 
    • LetsAuto
      By LetsAuto
      Hi! So im at a point where I can comfortably use the Koda interface, and i can manage my programs.. BUT..... i need information from a log file to be displayed in a disabled input box (so that way the user has no control over the content that is displayed)..... how does one do this?

      Note: I already have the .txt file, with the user input.. that part was easy.. but i just dont know how to retrieve it.. its going to be something with FileReadLine(), yes?
    • zbatev
      By zbatev
      Hi Again,

      I'm really stuck with this, I have a complex program now more than 3K lines, I'll only post the portion which is giving me a lot of headache.

      This slice of code will monitor where the active cursor is and when the user press enter it will call the function associated with the input field(Search Field). Each of these Search input box reside on its own Tab Control

      It does work pretty well HOWEVER if I left the cursor at the input field and fire up other applications such as notepad, the HotKey (enter) does not set to its default.

      Case Else ;user is doing something else other than pressing/clicking on buttons/controls $sFocus = ControlGetFocus($formAgentBuddy) $hFocus = ControlGetHandle($formAgentBuddy, "", $sFocus) $ctrlFocus = _WinAPI_GetDlgCtrlID($hFocus) Switch $hFocus Case $hnptSearchMeC HotKeySet("{ENTER}", "_SearchContactList") Case $hnptSearchMeR HotKeySet("{ENTER}", "_SearchReferenceList") Case $hnptSearchMeK HotKeySet("{ENTER}", "_SearchAccountList") Case $hnptSearchMeM HotKeySet("{ENTER}", "_SearchTemplateList") Case $hnptSearchMeL HotKeySet("{ENTER}", "_SearchAlarmList") Case Else HotKeySet("{ENTER}") EndSwitch
      I tried using GUISetAccelerators but I guess this cannot be dynamically changed like

      Case Else ;user is doing something else other than pressing/clicking on buttons/controls $sFocus = ControlGetFocus($formAgentBuddy) $hFocus = ControlGetHandle($formAgentBuddy, "", $sFocus) $ctrlFocus = _WinAPI_GetDlgCtrlID($hFocus) Switch $hFocus Case $hnptSearchMeC Dim $AccelKeys[1][2]=[["{ENTER}",$btnSearchContactList]] GUISetAccelerators($AccelKeys) Case $hnptSearchMeR Dim $AccelKeys[1][2]=[["{ENTER}",$btnSearchReferenceList]] GUISetAccelerators($AccelKeys) Case $hnptSearchMeK ;.... and so on Case $hnptSearchMeM ;.... and so on Case $hnptSearchMeL ;.... and so on Case Else Dim $AccelKeys = "" EndSwitch
      I also tried to monitor the Active Window with WinGetState and use BitAnd with an 8 but sadly that doesn't also do the trick even if I switch to other application my program seem to be still active even when its already greyed out like if I left the cursor at the Search Field(input Box) and I press enter in notepad instead of giving me a new line in notepad it executes the search in my application.