Jump to content

GUICtrlSetTip


anixon
 Share

Recommended Posts

How do you increase the time that a Tip is displayed or should the tip reman open whilst you are hovering over the control. If this is the case then it is not working on

my system (Windows XP SP@).

I have also noticed that if you hover on a control beyond the time that the Tip is displayed for that control then it is not possible to re-display the Tip by moving the

cursor on and off that control. If you then move to another control and do the same thing then you end up with two controls that will not re-display their tips.

If however you perform a non tip related process then the display for all controls appear to be reset and will then display the Tip.

Why is it so?

Ant...

Edit - More information

What appears to cause the problem is when you apply colour and and tool tips to the same button control for example:

$Enter = GUICtrlCreateButton("Enter", 5, 45, 40, 20)

GUICtrlSetTip(-1, " Process Input Field.", "VKeyboard", 1,1)

GUICtrlSetBkColor(-1,0xd8e8ff) ; Pale Blue

This code results in the Tool Tip not re-displaying after it times out. However if you remove the control items color it works perfectly.

$Enter = GUICtrlCreateButton("Enter", 5, 45, 40, 20)

GUICtrlSetTip(-1, " Process Input Field.", "VKeyboard", 1,1)

Can this problem be remedied?

Ant...

Edited by anixon
Link to comment
Share on other sites

I could be wrong but I think the GUICtrlSetTip() function basically works the same as windows default tooltip time.

You can use the ToolTip() function to dispaly a tooltip for the time you require..

It's probably a bit more work as you have to set the position and close the tooltip yourself as opposed to windows handling the length of time it displays.

Cheers

Edited by smashly
Link to comment
Share on other sites

I could be wrong but I think the GUICtrlSetTip() function basically works the same as windows default tooltip time.

You can use the ToolTip() function to dispaly a tooltip for the time you require..

It's probably a bit more work as you have to set the position and close the tooltip yourself as opposed to windows handling the length of time it displays.

Cheers

Thanks for your response.

Windows Balloon Tips display for as long as you have the cursor hovering over the Icon. There is however a short delay before the tip is displayed.

Based on this functionality I doubt if their is a control item to extend the short delay before display or if their is I have no idea where it might be

altered.

Thanks for pointing me to ToolTip however I think that CUICtrlSetTip() should probably function the say way as Windows.

I guess the question now is can CUICtrlSetTip() be made to operate in the same way as Windows?

Cheers

Ant...

Edited by anixon
Link to comment
Share on other sites

I see the problem, but don't know how it fix it.

The problem only applies to labels, input boxes, edit boxes, and other things that don't change when you hover on them.

As far as I can tell, the ToolTips work perfectly for buttons, check boxes, radio buttons.

For those who don't understand the problem, test out this code:

#include <GUIConstants.au3>

#Region ### START Koda GUI section ###
$Form1 = GUICreate("Form1", 184, 171, 193, 115)
$Label1 = GUICtrlCreateLabel("Label1", 32, 16, 36, 17)
GUICtrlSetTip(-1, "This tooltip doesn't ever reappear if"&@LF&"you hover until it disappears")
$Input1 = GUICtrlCreateInput("Input1", 32, 40, 89, 21)
GUICtrlSetTip(-1, "This is an input box")
$MyButton1 = GUICtrlCreateButton("MyButton1", 32, 72, 100, 30, $BS_FLAT)
GUICtrlSetTip(-1, "This tooltip DOES reappear if you move"&@LF&"your mouse away and then hover again")
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 32, 104, 113, 33)
GUICtrlSetTip(-1, "Just a checkbox")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Link to comment
Share on other sites

Hello there,

I am using a bunch of InputBox to set the variable values for my script. One of the variables is just to change the value from 'on' or 'off'. I decided to use GUICreate and GUICtrlCreateCombo, etc...to have a dropbox where I can select the value. The GUICreate script works fine by itself, where when I select either 'on' or 'off' and click 'OK' button, the GUI will close. However, when I added another lines of InputBox codes to it (starts from ;parity threshole***), the GUI remain opened while an InputBox popped up. I'd like to resolve this issue, where the GUI box is closed before an InputBox opens

Here is the code:

CODE
#include <GUIConstants.au3>

GUICreate("Change HMIT Status", _

300, 120, -1, -1) ; will create a dialog box that when displayed is centered

$GUI_DropBox = GUICtrlCreateCombo ("...Select Status...", 10, 10) ; create first item

GUICtrlSetData(-1,"on|off", "") ; add other item snd set a new default

$btn1=GUICtrlCreateButton ("OK", 30, 60, 70, 30)

GUICtrlSetState(-1,$GUI_FOCUS) ; the focus is on this button

$btn2=GUICtrlCreateButton ("Cancel", 150, 60, 70, 30)

GUISetState () ; will display an empty dialog box

Do

$msg = GUIGetMsg()

If $msg = $btn1 Then

If GUICtrlRead($GUI_DropBox) <> ("on") And GUICtrlRead($GUI_DropBox) <> ("off") Then

MsgBox(16, "Warning", "Please choose the status and click OK button!")

Else

$hmit_status = GUICtrlRead($GUI_DropBox)

$msg = $GUI_EVENT_CLOSE

EndIf

ElseIf $msg = $btn2 Then

Exit

EndIf

Until $msg = $GUI_EVENT_CLOSE

;parity threshole***

$parity_thresholds = InputBox("Change Parity Thresholds", "Enter a desire parity threshold!", "", " M2", _

-1, -1)

;real trace name***

$trace_realname = InputBox("Name of Trace", "Enter the exact trace name, ends with ' _ '. Do not enter Date/Time and TraceIndex!", "", " M200", _

800, 150)

Link to comment
Share on other sites

I see the problem, but don't know how it fix it.

The problem only applies to labels, input boxes, edit boxes, and other things that don't change when you hover on them.

As far as I can tell, the ToolTips work perfectly for buttons, check boxes, radio buttons.

For those who don't understand the problem, test out this code:

#include <GUIConstants.au3>

#Region ### START Koda GUI section ###
$Form1 = GUICreate("Form1", 184, 171, 193, 115)
$Label1 = GUICtrlCreateLabel("Label1", 32, 16, 36, 17)
GUICtrlSetTip(-1, "This tooltip doesn't ever reappear if"&@LF&"you hover until it disappears")
$Input1 = GUICtrlCreateInput("Input1", 32, 40, 89, 21)
GUICtrlSetTip(-1, "This is an input box")
$MyButton1 = GUICtrlCreateButton("MyButton1", 32, 72, 100, 30, $BS_FLAT)
GUICtrlSetTip(-1, "This tooltip DOES reappear if you move"&@LF&"your mouse away and then hover again")
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 32, 104, 113, 33)
GUICtrlSetTip(-1, "Just a checkbox")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

Thanks for the response please refer to my origional post which I have edited with addition information

Ant..

Link to comment
Share on other sites

Hello there,

I am new to this forum. Can anyone tell me how to create a new post?

Thanks

Most questions are posted in General Help and Support

Open AutoIT Web Page goto Forum - Logon - goto General Help and Support - Click on New Topic (just below messages on the right had side of the page) and

follow the bouncing ball... Pretty easy really.

Ant

Link to comment
Share on other sites

Hello there,

I am using a bunch of InputBox to set the variable values for my script. One of the variables is just to change the value from 'on' or 'off'. I decided to use GUICreate and GUICtrlCreateCombo, etc...to have a dropbox where I can select the value. The GUICreate script works fine by itself, where when I select either 'on' or 'off' and click 'OK' button, the GUI will close. However, when I added another lines of InputBox codes to it (starts from ;parity threshole***), the GUI remain opened while an InputBox popped up. I'd like to resolve this issue, where the GUI box is closed before an InputBox opens

Here is the code:

CODE
#include <GUIConstants.au3>

GUICreate("Change HMIT Status", _

300, 120, -1, -1) ; will create a dialog box that when displayed is centered

$GUI_DropBox = GUICtrlCreateCombo ("...Select Status...", 10, 10) ; create first item

GUICtrlSetData(-1,"on|off", "") ; add other item snd set a new default

$btn1=GUICtrlCreateButton ("OK", 30, 60, 70, 30)

GUICtrlSetState(-1,$GUI_FOCUS) ; the focus is on this button

$btn2=GUICtrlCreateButton ("Cancel", 150, 60, 70, 30)

GUISetState () ; will display an empty dialog box

Do

$msg = GUIGetMsg()

If $msg = $btn1 Then

If GUICtrlRead($GUI_DropBox) <> ("on") And GUICtrlRead($GUI_DropBox) <> ("off") Then

MsgBox(16, "Warning", "Please choose the status and click OK button!")

Else

$hmit_status = GUICtrlRead($GUI_DropBox)

$msg = $GUI_EVENT_CLOSE

EndIf

ElseIf $msg = $btn2 Then

Exit

EndIf

Until $msg = $GUI_EVENT_CLOSE

;parity threshole***

$parity_thresholds = InputBox("Change Parity Thresholds", "Enter a desire parity threshold!", "", " M2", _

-1, -1)

;real trace name***

$trace_realname = InputBox("Name of Trace", "Enter the exact trace name, ends with ' _ '. Do not enter Date/Time and TraceIndex!", "", " M200", _

800, 150)

You should post this as a seperate forum item however this is some code which switches things on and off

This is the user interface side of things

CODE

if $CapsFlag = 1 Then

$CapsL = GUICtrlCreateButton("Caps ON", 6, 65, 80, 22)

GUICtrlSetTip(-1, " Toggle Caps Lock ON and OFF.", "VKeyboard", 1,1)

GUICtrlSetBkColor(-1,0x00ff00) ; Green

ElseIf $CapsFlag = 0 Then

$CapsL = GUICtrlCreateButton("Caps OFF", 6, 65, 80, 22)

GUICtrlSetTip(-1, " Toggle Caps Lock ON and OFF.", "VKeyboard", 1,1)

GUICtrlSetBkColor(-1,0xff0000) ; Red

EndIf

And this is the processor for setting the flag

CODE

Case $msg = $Caps or $msg = $CapsL

If $CapsFlag = 0 Then

$CapsFlag = 1

ElseIf $CapsFlag = 1 Then

$CapsFlag = 0

EndIf

GUIDelete()

ExitLoop

Link to comment
Share on other sites

@ anixon in relation to your first post update, as a work around you could reset the tip when the button isn't being hovered over. Painfull but it works every time.

#include <GUIConstants.au3>

$Gui = GUICreate("", 100, 100)
$Enter = GUICtrlCreateButton("Enter", 5, 45, 40, 20)
GUICtrlSetBkColor(-1,0xd8e8ff) ; Pale Blue
GUISetState(@SW_SHOW)

While 1
    $GGCI = GUIGetCursorInfo($Gui)
    If $GGCI[4] = 0 Then GUICtrlSetTip($Enter, " Process Input Field.")
    $Msg = GUIGetMsg()
    Select 
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Cheers

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...