Log in

View Full Version : [REQ] How Add an Event in Python


AOTD_Rhonen
03-12-10, 03:13 PM
Hi guys,

anyone can help me by adding an Event on a Button?

def InitializeScript():

Show = False
Pagerecognitionmanual_Recmanual_Unit.Visible=False
Pagerecognitionmanual_Recmanual_Criticalzones.Visi ble=False
Pagerecognitionmanual_Recmanual_Cover.Visible=Fals e
Pagerecognitionmanual_Recmanual_Openbook.Visible= True
SetReconEvents()

#pass

def SetReconEvents():
ScriptManagerManaged.ShowPythonError("SETEVENTs")
Pagerecognitionmanual_Recmanual_Cover_Close.MouseL eftButtonClicked += OpenCloseManual
Pagerecognitionmanual_Recmanual_Openbook_BtnOpen.M ouseLeftButtonClicked += OpenCloseManual
#pass

def OpenCloseManual():
ScriptManagerManaged.ShowPythonError("EVENT")
So i get my Initialize and i get my Message on SetReconEvents()

But if i click on the BtnOpen ingame, nothing happens... so OpenCloseManual() is not handled ... Any Ideas?

And yes, i am working on the Reconitionmanual.
Both, Pagerecognitionmanual_Recmanual_Cover_Close.MouseL eftButtonClicked and Pagerecognitionmanual_Recmanual_Openbook_BtnOpen are Buttons

TheDarkWraith
03-12-10, 03:18 PM
Hi guys,

anyone can help me by adding an Event on a Button?

def InitializeScript():

Show = False
Pagerecognitionmanual_Recmanual_Unit.Visible=False
Pagerecognitionmanual_Recmanual_Criticalzones.Visi ble=False
Pagerecognitionmanual_Recmanual_Cover.Visible=Fals e
Pagerecognitionmanual_Recmanual_Openbook.Visible= True
SetReconEvents()

#pass

def SetReconEvents():
ScriptManagerManaged.ShowPythonError("SETEVENTs")
Pagerecognitionmanual_Recmanual_Cover_Close.MouseL eftButtonClicked += OpenCloseManual
Pagerecognitionmanual_Recmanual_Openbook_BtnOpen.M ouseLeftButtonClicked += OpenCloseManual
#pass

def OpenCloseManual():
ScriptManagerManaged.ShowPythonError("EVENT")
So i get my Initialize and i get my Message on SetReconEvents()

But if i click on the BtnOpen ingame, nothing happens... so OpenCloseManual() is not handled ... Any Ideas?

And yes, i am working on the Reconitionmanual.
Both, Pagerecognitionmanual_Recmanual_Cover_Close.MouseL eftButtonClicked and Pagerecognitionmanual_Recmanual_Openbook_BtnOpen are Buttons

for the control you want to add an event to use this syntax:

control.action += name of function to call

where control = the name of the control (i.e. Pagelayout_Groupfeedback)
action = the action the user did (i.e. MouseIn, MouseOut, MouseLeftButtonClicked, etc.)

AOTD_Rhonen
03-12-10, 03:24 PM
ok, i will recheck whats wrong.

thanks

TheDarkWraith
03-12-10, 03:35 PM
ok, i will recheck whats wrong.

thanks

ensure you unload the event when you're script is done (in unloadscript)

AOTD_Rhonen
03-12-10, 03:50 PM
ok, i will add the Lines :)