Q: Retrieving popup checkbox data?

jdog5000

Revolutionary
Joined
Nov 25, 2003
Messages
2,601
Location
California
I'm running into difficulty with civ's popups. I want to create a popup with several checkboxes, then when the popup is closed get the which boxes were checked. Simple enough, eh? I can get other types of popup data back, but not checkbox data. Here's what I'm trying:

popup.createPythonCheckBoxes( 4, 3 )
popup.setPythonCheckBoxText( 0, 'Pause at turn end', 'Pauses automation at the end of the turn, so you can inspect things', 3 )
popup.setPythonCheckBoxText( 1, 'Pause every 10', 'Pauses automation every 10 turns', 3 )
popup.setPythonCheckBoxText( 2, 'Cancel on war declared', 'Cancel automation if your civ becomes involved in a war', 3 )
popup.setPythonCheckBoxText( 3, 'Wake-up on game end', 'If someone (your civ?) wins, automation cancelled', 3 )

So, four checkboxes ... then, in a __PopupBegin function:

bitField = popupReturn.getCheckboxBitfield( 3 )

The game informs me that getCheckboxBitfield doesn't exist ... it's in the SDK code (CvPopupReturn.h), but apparently not exported to Python. After a lot of searching, I cannot find where any of these functions actually make it out to Python. Ideas? Looking at the following source for what functions are in CyPopupReturn I see no mention of getting anything from checkboxes ... period.

Has anyone succeeded in using checkboxes in a popup? Ideas?
 
You can try adding this to CvDLLPython.cpp and see if it works, but it may complain that you are redifining the python for CvPopupReturn:
Code:
	python::class_<CvPopupReturn>("CvPopupReturn")
		.def("getCheckBoxBitfield", &CvPopupReturn::getCheckBoxBitfield, "int (int group)")
 
Back
Top Bottom