Page 1 of 1

Changing xml files

Posted: Wed Sep 06, 2017 4:48 am
by delbourg
The hollywood script test.hws calls up an appropriate test.xml file towards the end of the script via createapp. How would one go about writing a script which, with appropriate radio button choice, calls up a different xml file depending on the choice.

Is that even possible?

Re: Changing xml files

Posted: Wed Sep 06, 2017 1:27 pm
by SamuraiCrow
If the child window is called using CreateRequester then yes.

Re: Changing xml files

Posted: Wed Sep 06, 2017 10:13 pm
by airsoftsoftwair
I'm not sure I fully understand this question but in case you're trying to create additional GUI objects when there is already a GUI, take a look at the Dynamic1.hws example script that comes with RapaGUI. It can open an unlimited number of windows.

Re: Changing xml files

Posted: Thu Sep 07, 2017 11:13 am
by delbourg
Let me rephrase my question. I have a hollywood script which acts exactly in the same way on one of a number of xml files. However in the actual script I have newr the end to specify the specific xml file which needs to be loaded.

Is there a way of introducing some sort of string variable, before the script is run, which will allow me to load the xml file I want? Someone mentioned child processes, but that just opens new windows or adds new menus or.. ; that is not what I am after.

Re: Changing xml files

Posted: Fri Sep 08, 2017 11:51 pm
by airsoftsoftwair
Hmm, I'm still not sure I understand this question. Of course you can use variables to change the XML file that is loaded, e.g.

Code: Select all

Switch a
Case 1:
  f$ = "gui1.xml"
Case 2:
  f$ = "gui2.xml"
Case 3:
  f$ = "gui3.xml"
EndSwitch

moai.CreateApp(FileToString(f$))
Is that what you're looking for?

Re: Changing xml files

Posted: Sun Sep 10, 2017 12:55 am
by delbourg
Yes thank you, I know how to do that, includng creating the app as a child process. In other words I can load whatever xml file I want. However the buttons on the loaded xml file seem to be inactive: when pressed they do nothing. I have a feeling it is some problem with my interpretation of msg for the newly loaded xml file. I looked at the dynamic1 example and found it thoroughly confusing, which is entirely my fault. Do I need to include the case of rapaGUI wit msg.action before callng on msg.attribute and how do I embed this among several msg.id ? What is the relevant order of introducing various msg.xxx?

Re: Changing xml files

Posted: Sun Sep 10, 2017 1:49 am
by PEB
Are you initializing RapaGUI with InstallEventHandler() after you create your moai.CreateApp()?

Re: Changing xml files

Posted: Sun Sep 10, 2017 7:35 am
by delbourg
Yes I have placed the InstallEventHandler command towards the end. I have a feeling that I have just not understood the way the messaging goes after i load the child window, which is why the buttons on the child window are inactive. I will have to study your dynamic1 example in more detail I think sinec I have obviously misunderstood something.

Re: Changing xml files

Posted: Sun Sep 10, 2017 11:18 am
by delbourg
I have got over my problems by simplifying the process. My primary script open a primary xml file where I make a choice of secondary xml file and associated window, closing the primary window in the process. Closing the second window ends the program and this avoids adding and opening extra windows.

I clearly have a lot to learn, but I have learnt enough to achieve my main objective. Thanks to you all for tips.