Sign in to follow this  
Followers 0
Damein

GUICtrlSetOnEvent problem

3 posts in this topic

#1 ·  Posted (edited)

I've used this function in many of my scripts, but for some reason I can't seem to figure out why it won't go in this one.

Global $NewItemLabel, $NewCost, $TotalWeeklyCost, $VarianceFromLastWeek, $SaveBudgetButton, $IniFile, $IniFileInfo, $LastWeeksBudgetTab, $CurrentWeeksBudgetTab
 
Opt("GUIOnEventMode", 1)
 
_CreateGui()
 
Func _CreateGui()
     GuiCreate("Budgeting System", 800, 700, Default, Default)
     GuiCtrlCreateTab(10,5,780,680)
     $LastWeeksBudgetTab = GuiCtrlCreateTabItem("Previous Week")
     GUICtrlSetOnEvent($LastWeeksBudgetTab, "_PreviousWeeksBudgetDisplay")
     $CurrentWeeksBudgetTab = GuiCtrlCreateTabItem("Current Week")
     GUICtrlSetOnEvent($CurrentWeeksBudgetTab, "_CurrentWeeksBudgetDisplay")
     GuiSetState()
EndFunc
 
Func _PreviousWeeksBudgetDisplay()
     Msgbox(0, "Test", "Previous")
EndFunc
 
Func _CurrentWeeksBudgetDisplay()
     Msgbox(0, "test", "Current")
EndFunc
 
While 1
    Sleep(10)
WEnd
Edited by Damein

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites



#include <GuiConstantsEx.au3>

Global $NewItemLabel, $NewCost, $TotalWeeklyCost, $VarianceFromLastWeek, $SaveBudgetButton, $IniFile, $IniFileInfo, $LastWeeksBudgetTab, $CurrentWeeksBudgetTab
Global $Tab1
Opt("GUIOnEventMode", 1)

_CreateGui()

Func _CreateGui()
    Local $G1 = GUICreate("Budgeting System", 800, 700, Default, Default)
    $Tab1 = GUICtrlCreateTab(10, 5, 780, 680)
    $LastWeeksBudgetTab = GUICtrlCreateTabItem("Previous Week")
    GUICtrlSetOnEvent($LastWeeksBudgetTab, "_PreviousWeeksBudgetDisplay")
    $CurrentWeeksBudgetTab = GUICtrlCreateTabItem("Current Week")
    ;GUICtrlSetOnEvent($CurrentWeeksBudgetTab, "_CurrentWeeksBudgetDisplay")
    GUICtrlSetOnEvent($Tab1, "_CurrentWeeksBudgetDisplay")
    GUICtrlCreateTabItem("")
    GUISetState()
    GUISetOnEvent($GUI_EVENT_CLOSE, "AllDone", $G1)
EndFunc   ;==>_CreateGui

Func _PreviousWeeksBudgetDisplay()
    MsgBox(0, "Test", "Previous")
EndFunc   ;==>_PreviousWeeksBudgetDisplay

Func _CurrentWeeksBudgetDisplay()
    Switch GUICtrlRead($Tab1)
        Case 0
            MsgBox(0, "test", "Previous")
        Case 1
            MsgBox(0, "test", "Current")
    EndSwitch
EndFunc   ;==>_CurrentWeeksBudgetDisplay

While 1
    Sleep(10)
WEnd

Func AllDone()
    Exit
EndFunc   ;==>AllDone


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I struggled with this problem for about 30 minutes before I gave up on trying to help. Now I understand. Thanks for the solution, martin.


#include <ByteMe.au3>

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  
Followers 0