CyPopup() ?

Sto

Should i code today ...
Joined
Dec 15, 2005
Messages
1,144
Location
Marseille (France)
i try to make a popup with some listbox , edit box , etc ....

I've just made a little popup with an edit box and a python button that should call a function to make a test :

Code:
        popup = CyPopup(0,EventContextTypes.NO_EVENTCONTEXT,True)
        popup.setHeaderString("Popup test", CvUtil.FONT_CENTER_JUSTIFY)
        popup.createPythonEditBox( "editbox1" ,"info 1", 0 )
        popup.createPythonEditBox( "editbox2" ,"info 2", 1 )
        popup.addPythonButton( "popup_Function", "launch", "info", "", -1, -1, True )
        popup.launch(False, PopupStates.POPUPSTATE_IMMEDIATE)

i've added popup_Function to CvPopupInterface.py :

Code:
        def popup_Function(argsList):
                print " working ?"

But i can't achieve to retrieve the values from the edit box . I've tried a lot of thing but without success . When i click on the button , i get nothing : no bug , nothing in the pythonlog file .

Did someone succeed (or not) in retrieving values from this kind of popups ? or can help me ?

help :cry:

Tcho !
 
There was a tutorial on popups not too long ago. I think that it said the popups can't be used for information entries. You would need to make a custom screen for that. But I may be wrong, so look around for the popup tutorial.
 
I've already read all the tutorial for popup made by Kael . But he use CyPopupInfo() and not CyPopup() . I still have a little hope that CyPopup() and CyPopupReturn() can be used . Or perhaps someone know if this is impossible ?

Thanks , Tcho !

Edit : I find a track with the way you edit the city name that use CyPopup() , i will try to make some tests with that ... :eek:
 
Yea, I think the only way to retrieve data from CyPopups is when you use them in conjunction with event handlers, like the city naming event. One of the event handling functions, either the begin or apply, you get a PopupReturn object as an argument. Other then that I've found no way to get the data from the popup, though that doesn't mean their isn't another way. :)
 
Have you found the file CvPopupInterface.py in the Python\EntryPoints folder of Vanilla Civ4 ?

There's some examples in that file of what you can do with CyPopup.
 
Yea, I think the only way to retrieve data from CyPopups is when you use them in conjunction with event handlers, like the city naming event. One of the event handling functions, either the begin or apply, you get a PopupReturn object as an argument. Other then that I've found no way to get the data from the popup, though that doesn't mean their isn't another way. :)

Thanks :) , i will try to do with that . The hard part will be to add the events through the map scripts . Do you know a MOD where complex pop up has been made ( i mean with lots of settings and the location XY defined ) ? that should be a great help for me .

Tcho !
 
Have you found the file CvPopupInterface.py in the Python\EntryPoints folder of Vanilla Civ4 ?

There's some examples in that file of what you can do with CyPopup.

Yes thanks i've seen it ( sorry i miss your post while replying ) :) . The problem is to retrieve the values entered . I've missed that that need to create events . I will begin to test that tomorrow .

Tcho !
 
If you are looking for an example of the CyPopup in use with an event handler and a PopupReturn object, checkout the Great Statesman mod by TheLopez. It is linked in his library thread. It has a simple example of the whole thing in use. The mod is only updated to Warlords 2.08, but should give you the gist of what is needed. :)
 
If you are looking for an example of the CyPopup in use with an event handler and a PopupReturn object, checkout the Great Statesman mod by TheLopez. It is linked in his library thread. It has a simple example of the whole thing in use. The mod is only updated to Warlords 2.08, but should give you the gist of what is needed. :)

Thank you very much :) , i will take a look at this . But adding event with python is more difficult than i though .

Tcho !
 
Top Bottom