Jump to content
Sign in to follow this  
RAMzor

GUICtrlSetTip() not work - bug?

Recommended Posts

RAMzor

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

Share this post


Link to post
Share on other sites
DjDeep00

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()

Share this post


Link to post
Share on other sites
youknowwho4eva

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

Share this post


Link to post
Share on other sites
MrCreatoR

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

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
youknowwho4eva

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

Share this post


Link to post
Share on other sites
jpm

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

Share this post


Link to post
Share on other sites
RAMzor

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

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
Sign in to follow this  

×