Jump to content
Sign in to follow this  
LuigiMario

GUI Glitches (maybe tab related?)

Recommended Posts

LuigiMario

Hello there. I've spent a couple of hours to design a good option dialog with koda for an autoit script i'm making. Then I started to add some actions to the code, and I get two strange behaviours.

The first one is related to a label. On the first tab there are two sliders, if you move the first one, the text on the label above should change to the number currently selected by the slider. The strange thing is that the label isn't updated, it looks like the text inside gets over the previous text. When you change tab and then go back to the first one, the text shows fine. (See screenshot below)

post-21273-1225234337_thumb.jpg

The second one is related to the editboxes of the second and third tabs: they don't draw properly until you hover the mouse on them.

Here is the code I'm using: I tried on XP and on Vista, but nothing changes. What's wrong with this script? Any help is apreciated.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ###
$Form1_1 = GUICreate("Blah - Meh", 307, 426, 192, 152, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_CLIPCHILDREN,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
$Label1 = GUICtrlCreateLabel("Blah", 0, 0, 306, 37, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, 16, 800, 0, "Verdana")
$Tab1 = GUICtrlCreateTab(0, 40, 305, 353)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("General")
$startwithwin = GUICtrlCreateCheckbox("Start with windows", 8, 360, 173, 17)
$Group1 = GUICtrlCreateGroup("Monitor", 12, 80, 285, 269)
$Label2 = GUICtrlCreateLabel("Check for changes every", 20, 100, 130, 17)
$slidercheckevery = GUICtrlCreateSlider(16, 120, 274, 33, BitOR($TBS_AUTOTICKS,$TBS_FIXEDLENGTH))
GUICtrlSetLimit(-1, 60, 1)
GUICtrlSetData(-1, 1)
$Label3 = GUICtrlCreateLabel("Second", 20, 156, 47, 17)
$Label4 = GUICtrlCreateLabel("Minute", 256, 156, 36, 17)
$labelcheckevery = GUICtrlCreateLabel("?? seconds.", 156, 100, 124, 17)
$Label5 = GUICtrlCreateLabel("Start checking after 1 minute.", 20, 180, 262, 17)
$Slider1 = GUICtrlCreateSlider(20, 200, 270, 37)
GUICtrlSetLimit(-1, 5, 0)
$Label6 = GUICtrlCreateLabel("Immediately", 20, 240, 34, 17)
$Label7 = GUICtrlCreateLabel("5 mins", 252, 240, 40, 17)
$Label8 = GUICtrlCreateLabel("Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah", 16, 264, 272, 77)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet2 = GUICtrlCreateTabItem("Exclusion")
$Group2 = GUICtrlCreateGroup("Exclusion", 12, 80, 285, 269)
$Label9 = GUICtrlCreateLabel("Do not check these elements:", 24, 96, 170, 17)
$inputdontcheck = GUICtrlCreateInput("can you see me?", 28, 116, 253, 21)
$Label10 = GUICtrlCreateLabel(" blah blah blah blah blah blah blah blah blah blah blah", 20, 164, 258, 81)
$Label11 = GUICtrlCreateLabel("Do not check those elements:", 20, 252, 142, 17)
$chkexcludeh = GUICtrlCreateCheckbox("Red", 24, 276, 65, 17)
$chckexcludec= GUICtrlCreateCheckbox("Blue", 24, 296, 97, 17)
$chkexcluder = GUICtrlCreateCheckbox("Green", 152, 276, 97, 17)
$chkexcluden = GUICtrlCreateCheckbox("Yellow", 152, 296, 97, 17)
$Label12 = GUICtrlCreateLabel("Insert item names", 20, 140, 262, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet3 = GUICtrlCreateTabItem("Icons")
$Group3 = GUICtrlCreateGroup("Customize icon", 12, 72, 285, 257)
$chkhddicon = GUICtrlCreateCheckbox("Customize hard disk icon", 20, 92, 189, 17)
$iconahdd = GUICtrlCreateIcon("", 0, 36, 112, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
$hddiconpath = GUICtrlCreateInput("hddiconpath", 72, 116, 149, 21)
$btnsfogliahdd = GUICtrlCreateButton("Browse", 228, 112, 63, 25, 0)
$chkcdromicon = GUICtrlCreateCheckbox("Customize optical drive icon", 20, 149, 189, 17)
$iconacdrom = GUICtrlCreateIcon("", 0, 38, 168, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
$cdromiconpath = GUICtrlCreateInput("cdromiconpath", 73, 172, 149, 21)
$btnsfogliacd = GUICtrlCreateButton("Browse", 228, 170, 63, 25, 0)
$chkremicon = GUICtrlCreateCheckbox("Customize removable media icon", 20, 204, 205, 17)
$iconarem = GUICtrlCreateIcon("", 0, 38, 224, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
$remiconpath = GUICtrlCreateInput("remiconpath", 74, 230, 149, 21)
$btnsfogliarem = GUICtrlCreateButton("Browse", 228, 230, 63, 25, 0)
$chkneticon = GUICtrlCreateCheckbox("Customize network drive icon", 20, 262, 205, 17)
$neticon = GUICtrlCreateIcon("", 0, 36, 279, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
$neticonpath = GUICtrlCreateInput("neticonpath", 73, 284, 149, 21)
$btnsfoglianet = GUICtrlCreateButton("Browse", 228, 281, 63, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$editfillindicatorlist = GUICtrlCreateInput("", 28, 352, 213, 21)
GUICtrlSetTip(-1, "Insert drive letters")
$chkfillindicator = GUICtrlCreateCheckbox("Do some nice things:", 12, 332, 257, 17)
$chkfillall = GUICtrlCreateCheckbox("Sure", 252, 352, 45, 17)
$TabSheet4 = GUICtrlCreateTabItem("About")
$Label13 = GUICtrlCreateLabel("Blah!", 4, 72, 279, 63, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, 36, 800, 0, "Verdana")
$Label14 = GUICtrlCreateLabel(":/", 104, 332, 94, 17)
$Label15 = GUICtrlCreateLabel("What's wrong with this script?", 8, 364, 286, 17)
GUICtrlCreateTabItem("")
$btnsave = GUICtrlCreateButton("Save", 148, 396, 75, 25, 0)
$btncancel = GUICtrlCreateButton("Cancel", 228, 396, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###



While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            guidelete($form1_1)
            Exitloop
        Case $startwithwin
        Case $slidercheckevery
            guictrlsetdata($labelcheckevery,"         ")
            guictrlsetdata($labelcheckevery,"" & guictrlread($slidercheckevery) & " seconds.")
        Case $btncancel
            guidelete($form1_1)
            exitloop
    EndSwitch
WEnd
Edited by LuigiMario

Share this post


Link to post
Share on other sites
LuigiMario

It was THAT simple? :(

Thanks a lot. :P

Share this post


Link to post
Share on other sites
senthor

But the real problem is: How to make those stupid sliders have the same color as the tab control?

Edited by senthor

Share this post


Link to post
Share on other sites
Zedna

Problem 1) is fixed by this:

$Form1_1 = GUICreate("Blah - Meh", 307, 426, 192, 152)

Also guictrlsetdata($labelcheckevery," ") is not needed

Edited by Zedna

Share this post


Link to post
Share on other sites
senthor

OK, I tried the following:

By PixelGetColor I receive the color of the surrounding tab and then I can use it with GUICtrlSetBkColor.

But for about 1/10 s it has the wrong color...

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  

×