Changing xml files

Discuss any general programming issues here

Changing xml files

Postby delbourg » Wed Sep 06, 2017 4:48 am

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?
delbourg
 
Posts: 21
Joined: Tue Jun 20, 2017 6:07 am
Location: Tasmania

Re: Changing xml files

Postby SamuraiCrow » Wed Sep 06, 2017 1:27 pm

If the child window is called using CreateRequester then yes.
SamuraiCrow
 
Posts: 101
Joined: Fri May 15, 2015 5:15 pm
Location: Ft. Collins, Colorado USA

Re: Changing xml files

Postby airsoftsoftwair » Wed Sep 06, 2017 10:13 pm

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.
User avatar
airsoftsoftwair
 
Posts: 2240
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Changing xml files

Postby delbourg » Thu Sep 07, 2017 11:13 am

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.
delbourg
 
Posts: 21
Joined: Tue Jun 20, 2017 6:07 am
Location: Tasmania

Re: Changing xml files

Postby airsoftsoftwair » Fri Sep 08, 2017 11:51 pm

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?
User avatar
airsoftsoftwair
 
Posts: 2240
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Changing xml files

Postby delbourg » Sun Sep 10, 2017 12:55 am

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?
delbourg
 
Posts: 21
Joined: Tue Jun 20, 2017 6:07 am
Location: Tasmania

Re: Changing xml files

Postby PEB » Sun Sep 10, 2017 1:49 am

Are you initializing RapaGUI with InstallEventHandler() after you create your moai.CreateApp()?
PEB
 
Posts: 152
Joined: Sun Feb 21, 2010 2:28 am

Re: Changing xml files

Postby delbourg » Sun Sep 10, 2017 7:35 am

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.
delbourg
 
Posts: 21
Joined: Tue Jun 20, 2017 6:07 am
Location: Tasmania

Re: Changing xml files

Postby delbourg » Sun Sep 10, 2017 11:18 am

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.
delbourg
 
Posts: 21
Joined: Tue Jun 20, 2017 6:07 am
Location: Tasmania


Return to General programming

Who is online

Users browsing this forum: No registered users and 3 guests

cron