SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 03-12-10, 03:13 PM   #1
AOTD_Rhonen
A-ganger
 
Join Date: May 2006
Posts: 76
Downloads: 31
Uploads: 0
Default [REQ] How Add an Event in Python

Hi guys,

anyone can help me by adding an Event on a Button?
Code:
def InitializeScript():
    
    Show = False
    Pagerecognitionmanual_Recmanual_Unit.Visible=False
    Pagerecognitionmanual_Recmanual_Criticalzones.Visible=False
    Pagerecognitionmanual_Recmanual_Cover.Visible=False
    Pagerecognitionmanual_Recmanual_Openbook.Visible= True
    SetReconEvents()
    
    #pass

def SetReconEvents():
    ScriptManagerManaged.ShowPythonError("SETEVENTs")
    Pagerecognitionmanual_Recmanual_Cover_Close.MouseLeftButtonClicked += OpenCloseManual
    Pagerecognitionmanual_Recmanual_Openbook_BtnOpen.MouseLeftButtonClicked += 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
__________________

Member of A.O.T.D


Es gibt zwei Arten von Bugs
1. Programmfehler
2. Fehler zwischen Monitor und Sitzlehne

Die 2. sind die schlimmeren, denn die kann man nicht beheben.
AOTD_Rhonen is offline   Reply With Quote
Old 03-12-10, 03:18 PM   #2
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by AOTD_Rhonen View Post
Hi guys,

anyone can help me by adding an Event on a Button?
Code:
def InitializeScript():
 
    Show = False
    Pagerecognitionmanual_Recmanual_Unit.Visible=False
    Pagerecognitionmanual_Recmanual_Criticalzones.Visible=False
    Pagerecognitionmanual_Recmanual_Cover.Visible=False
    Pagerecognitionmanual_Recmanual_Openbook.Visible= True
    SetReconEvents()
 
    #pass
 
def SetReconEvents():
    ScriptManagerManaged.ShowPythonError("SETEVENTs")
    Pagerecognitionmanual_Recmanual_Cover_Close.MouseLeftButtonClicked += OpenCloseManual
    Pagerecognitionmanual_Recmanual_Openbook_BtnOpen.MouseLeftButtonClicked += 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.)
TheDarkWraith is offline   Reply With Quote
Old 03-12-10, 03:24 PM   #3
AOTD_Rhonen
A-ganger
 
Join Date: May 2006
Posts: 76
Downloads: 31
Uploads: 0
Default

ok, i will recheck whats wrong.

thanks
__________________

Member of A.O.T.D


Es gibt zwei Arten von Bugs
1. Programmfehler
2. Fehler zwischen Monitor und Sitzlehne

Die 2. sind die schlimmeren, denn die kann man nicht beheben.
AOTD_Rhonen is offline   Reply With Quote
Old 03-12-10, 03:35 PM   #4
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by AOTD_Rhonen View Post
ok, i will recheck whats wrong.

thanks
ensure you unload the event when you're script is done (in unloadscript)
TheDarkWraith is offline   Reply With Quote
Old 03-12-10, 03:50 PM   #5
AOTD_Rhonen
A-ganger
 
Join Date: May 2006
Posts: 76
Downloads: 31
Uploads: 0
Default

ok, i will add the Lines
__________________

Member of A.O.T.D


Es gibt zwei Arten von Bugs
1. Programmfehler
2. Fehler zwischen Monitor und Sitzlehne

Die 2. sind die schlimmeren, denn die kann man nicht beheben.
AOTD_Rhonen is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 09:58 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.