Jump to content

Recommended Posts

Posted

Hi all,

Why GUICtrlSetTip() not working in my example, what I am doing wrong?

#include <GUIConstants.au3>
#include <StaticConstants.au3>

GUICreate("My GUI", 250, 150)
$Btn1 = GUICtrlCreateButton("ON", 10, 10, 50)
$Btn2 = GUICtrlCreateButton("OFF", 10, 40, 50)
GUISetState(@SW_SHOW)

$Label = GUICtrlCreateLabel("Test", 70, 45, 53, 15)
GUICtrlSetStyle(-1, $SS_GRAYFRAME)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Btn1
            GUICtrlSetStyle($Label, 0)
            GUICtrlSetBkColor($Label, 0xFFFF00)
            GUICtrlSetTip($Label, "My TIP")
        Case $Btn2
            GUICtrlSetStyle(-1, $SS_GRAYFRAME)
    EndSwitch
WEnd
GUIDelete()

Thanks in advance

Posted

No bug...After you set the correct styles the tips should display...See comments below...

#include <GUIConstants.au3>
#include <StaticConstants.au3>

GUICreate("My GUI", 250, 150)
$Btn1 = GUICtrlCreateButton("ON", 10, 10, 50)
$Btn2 = GUICtrlCreateButton("OFF", 10, 40, 50)
GUISetState(@SW_SHOW)

$Label = GUICtrlCreateLabel("Test", 70, 45, 53, 15)
GUICtrlSetStyle(-1, $SS_GRAYFRAME);--> This is incorrect, as you can see your text "test" disappears.

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Btn1
            GUICtrlSetStyle($Label, 0);---> This is incorrect, there is no such style.
            GUICtrlSetBkColor($Label, 0xFFFF00)
            GUICtrlSetTip($Label, "My TIP")
        Case $Btn2
            GUICtrlSetStyle(-1, $SS_GRAYFRAME);---> Same mistake.
    EndSwitch
WEnd
GUIDelete()

Did you want this?

#include <GUIConstants.au3>
#include <StaticConstants.au3>

GUICreate("My GUI", 250, 150)

$Btn1 = GUICtrlCreateButton("ON", 10, 10, 50)
$Btn2 = GUICtrlCreateButton("OFF", 10, 40, 50)
GUISetState(@SW_SHOW)

$Label = GUICtrlCreateLabel("OFF", 70, 45, 53, 20,-1,$SS_GRAYRECT)


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Btn1
            GUICtrlSetBkColor($Label, 0xFFFF00)
            GUICtrlSetData($Label,"ON")
            GUICtrlSetTip($Label, "My TIP")
        Case $Btn2
            GUICtrlSetBkColor($Label, 0xE0DFE3)
            GUICtrlSetData($Label,"OFF")
            GUICtrlSetTip($Label, "")
    EndSwitch
WEnd
GUIDelete()
Posted (edited)

appears to me it doesn't work in the loop. I put it out of the loop and it worked fine. Other then turning it on and off.

On a second look. It's the style changes that are affecting it.

DjDeep answered first and better :)

I couldn't get the tip to change, is it because you change the data that it can change?

NVM figured out what I was doing wrong.

Edited by youknowwho4eva

Giggity

Posted

Actualy there is a bug:

#include <GUIConstants.au3>
#include <StaticConstants.au3>

GUICreate("Test GUI", 250, 150)

$Label = GUICtrlCreateLabel("Test", 70, 45, 53, 15)

GUICtrlSetTip($Label, "My TIP")
GUICtrlSetStyle($Label, BitOr($GUI_SS_DEFAULT_LABEL, $SS_CENTER)) ;That's it, tip is not shown

GUISetState()

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

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted (edited)

appears to me to be something with ss_center

Edit: just tried with the other gui default label whatever, and that didn't work alone either

Edited by youknowwho4eva

Giggity

Posted

don't forget to add forced style as $SS_NOTIFY for label as GUICtrlSetStyle with only restore the style you sent to :)

Posted (edited)

  jpm said:

don't forget to add forced style as $SS_NOTIFY ...

Got it working! :) Thanks!

#include <GUIConstants.au3>
#include <StaticConstants.au3>

GUICreate("My GUI", 250, 150)
$Btn1 = GUICtrlCreateButton("ON", 10, 10, 50)
$Btn2 = GUICtrlCreateButton("OFF", 10, 40, 50)
GUISetState(@SW_SHOW)

$Label = GUICtrlCreateLabel("Test", 70, 45, 53, 15)
GUICtrlSetStyle(-1, $SS_GRAYFRAME)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Btn1
            GUICtrlSetStyle($Label, BitOr($GUI_SS_DEFAULT_LABEL, $SS_NOTIFY))
            GUICtrlSetBkColor($Label, 0xFFFF00)
            GUICtrlSetTip($Label, "My TIP")
        Case $Btn2
            GUICtrlSetStyle(-1, $SS_GRAYFRAME)
    EndSwitch
WEnd
GUIDelete()

In general enough set $SS_NOTIFY style only. GUICtrlSetStyle($Label, $SS_NOTIFY)

In any case, I think, the story with GUICtrlSetTip() looks a little bugy. In fact, I set a TIP for control regardless of style!?

Edited by RAMzor

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
  • Recently Browsing   0 members

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