Changing xml files

Discuss any general programming issues here
Post Reply
delbourg
Posts: 21
Joined: Tue Jun 20, 2017 6:07 am
Location: Tasmania

Changing xml files

Post 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?
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: Changing xml files

Post by SamuraiCrow »

If the child window is called using CreateRequester then yes.
I'm on registered MorphOS using FlowStudio.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Changing xml files

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

Re: Changing xml files

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

Re: Changing xml files

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

Re: Changing xml files

Post 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?
PEB
Posts: 567
Joined: Sun Feb 21, 2010 1:28 am

Re: Changing xml files

Post by PEB »

Are you initializing RapaGUI with InstallEventHandler() after you create your moai.CreateApp()?
delbourg
Posts: 21
Joined: Tue Jun 20, 2017 6:07 am
Location: Tasmania

Re: Changing xml files

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

Re: Changing xml files

Post 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.
Post Reply