phil11 Posted January 5, 2008 Posted January 5, 2008 Hi everybody, happy new year to all of you i just started with Autoit, have some knowleges in vba, and couldn't find some help about my prob. via "search" so i create some buttons and labels with koda and want that wenn i click on Button1 that the Label2 changes its color or get hidden here's a part of the script : CODE$Button1 = GUICtrlCreateButton("", 93, 15, 16, 16, 0) GUICtrlSetBkColor(-1, 0x515251) GUICtrlSetOnEvent(-1, "Button1Click") GUICtrlSetCursor (-1, 3) $Button2 = GUICtrlCreateButton("", 160, 15, 16, 16, $BS_DEFPUSHBUTTON) GUICtrlSetBkColor(-1, 0x515251) GUICtrlSetOnEvent(-1, "Button2Click") GUICtrlSetCursor (-1, 3) $Label1 = GUICtrlCreateLabel("Nav", 83, 54, 33, 24) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetOnEvent(-1, "Button1Click") $Label2 = GUICtrlCreateLabel("Nav", 83, 54, 33, 24) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetOnEvent(-1, "Button2Click") #EndRegion ### END Koda GUI section ### Func Button1Click() If "Button1Click" = True Then $Label2 = GUICtrlSetColor(-1, 0x00FFFF) $Label3 = GUICtrlSetState(1, $GUI_HIDE) EndIf EndFunc Thanks for some help Phil
covaks Posted January 5, 2008 Posted January 5, 2008 Func Button1Click() If @GUI_CtrlId = $Button1 Then GUICtrlSetState($Label2,$GUI_HIDE) EndIf EndFunc
phil11 Posted January 5, 2008 Author Posted January 5, 2008 thank you i tried it compiled too, ... doesn't work thanks for help
Zedna Posted January 5, 2008 Posted January 5, 2008 I don't know what exactly do you want but here is some functional code. Note: You posted only code snippet and not whole reproduccing script. In future post whole reproduccing script to get more help. expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) GUICreate("My GUI",300,200,-1,-1,BitOr($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX)) GUISetOnEvent($GUI_EVENT_CLOSE, "OnClose") $Button1 = GUICtrlCreateButton("", 93, 15, 16, 16, 0) GUICtrlSetBkColor(-1, 0x515251) GUICtrlSetOnEvent(-1, "Buttonclick") GUICtrlSetCursor(-1, 3) $Button2 = GUICtrlCreateButton("", 160, 15, 16, 16, $BS_DEFPUSHBUTTON) GUICtrlSetBkColor(-1, 0x515251) GUICtrlSetOnEvent(-1, "Buttonclick") GUICtrlSetCursor(-1, 3) $Label1 = GUICtrlCreateLabel("Nav1", 83, 54, 33, 24) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetOnEvent(-1, "Buttonclick") $Label2 = GUICtrlCreateLabel("Nav2", 150, 54, 33, 24) GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetOnEvent(-1, "Buttonclick") GUISetState (@SW_SHOW) While 1 Sleep(100) WEnd Func OnClose() Exit EndFunc Func Buttonclick() GUICtrlSetState(@GUI_CtrlId, $GUI_HIDE) ; hide clicked button If @GUI_CtrlId = $Button1 Then GUICtrlSetColor($Label1, 0x00FFFF) EndIf If @GUI_CtrlId = $Button2 Then GUICtrlSetColor($Label2, 0x00FFFF) EndIf EndFunc ;==>Button1Click Resources UDF ResourcesEx UDF AutoIt Forum Search
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now