Newbie question about RapaGui

Discuss GUI programming with the RapaGUI plugin here
Post Reply
User avatar
NubeCheCorre
Posts: 77
Joined: Mon Mar 19, 2012 1:24 am
Contact:

Newbie question about RapaGui

Post by NubeCheCorre »

I am trying to create a simple CMS program. The template of the program is this one:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<application>

   <menubar id="mymenubar">
       <menu title="Clienti">
           <item help="Inserisce un nuovo cliente">Nuovo Cliente</item>
           <item help="Elenca i clienti">Elenco Clienti</item>
       </menu>
       <menu title="Assistenze">
           <item help="Inserisce una nuova assistenza">Nuova Assistenza</item>
           <item help="Elenca tutte le assistenze effettuate">Elenco Assistenze</item>
       </menu>
       <menu title="Fatture">
           <item help="Crea una nuova fattura">Nuova Fattura</item>
           <item help="Elenca tutte le fatture emesse">Elenco Fatture</item>
       </menu>
       <menu title="Antivirus">
           <item help="Inserisce un nuovo antivirus">Nuovo Antivirus</item>
           <item help="Elenca gli antivirus in scadenza">Elenco Scadenze</item>
       </menu>
   </menubar>

   <window id="win" menubar="mymenubar" title="CMS" width="800" height="600">
         <vgroup>
            <listview>
               <column/>
            </listview>
         </vgroup>
   </window>
</application>
Inside the windows tag i put a vgroup and a listview element as Hollywood need at least a group and an element as far as I understood until now. In this very simple schema now the code is that when I press on the menu the option "Nuovo Cliente" I can add a new customer. In order to achieve this I understood that I need to add code, inside the hollywood file (cms.hws), to create, or add, a new window with a form inside to fill with information about customer. To do this the function to use for is: moai.DoMethod(id, "AddWindow", window) or moai.CreateDialog() ? or moai.DoMethod(id, "AddWindow", window) is only for detached window already declared and closed or hidden?

Thanks for the help, really appreciated!

SamuraiCrow
Posts: 330
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: Newbie question about RapaGui

Post by SamuraiCrow »

I'd use moai.CreateDialog() as long as the form doesn't have to open any additional tabs or windows and as long as the creation form doesn't need to be kept open while operations are still acted upon in the main window.
I'm on registered MorphOS using FlowStudio.

User avatar
NubeCheCorre
Posts: 77
Joined: Mon Mar 19, 2012 1:24 am
Contact:

Re: Newbie question about RapaGui

Post by NubeCheCorre »

well I need to open a window and fill information so there will be textbox but also a list gadget with option, then there will be a save button and a query to sql database to store the datas and then close the window.. I will work on this opened window and not on the main window at the same time. So what's the best option for me?

And by the way, what's the other way to open a new window inside the main (parent window)?

Thanks for the reply and the help!
Davide

User avatar
NubeCheCorre
Posts: 77
Joined: Mon Mar 19, 2012 1:24 am
Contact:

Re: Newbie question about RapaGui

Post by NubeCheCorre »

ok I was able to attach a new window on the fly reading the documentation but also found that the documentation is wrong(??)

here is my code:

Code: Select all

/****************************************************************
**                                                             **
** Name:        CMS		                                       **
** Author:      Davide Palombo	                               **
** Version:     1.0                                            **
** Date:        09.08.20                                       **
** Interpreter: Hollywood 8.0                                  **
** Licence:     Sample program                                 **
** Function:    CMS Program          						   **
**                                                             **
** History:                                                    **
**                                                             **
** 1.0: (09.08.20)                                             **
**                                                             **
** - initial release                                           **
**                                                             **
****************************************************************/

/*
** Make sure we have at least Hollywood 8.0!
*/
@VERSION 8,0

/*
** This script requires the RapaGUI plugin
*/
@REQUIRE "RapaGUI"

/*
** Information about this app
*/

@APPTITLE "CMS"
@APPVERSION "$VER: Dynamic 1.0 (09.08.20)"
@APPCOPYRIGHT "(C) 2020 Davide Palombo"
@APPAUTHOR "Davide Palombo"
@APPDESCRIPTION "Cms program"

moai.CreateApp(FileToString("cms.xml"))

moai.CreateObject([[
<window id="newwindow" title="A new window">
  <vgroup>
      <button>Hello World!</button>
   </vgroup>
</window>
]])

moai.DoMethod("app", "addwindow", "newwindow")
moai.Set("newwindow", "open", True)

Repeat
   WaitEvent
Forever
it works, it open the main window and open also a small window with the hello world button but in the documentation there is written:

Code: Select all

mui.DoMethod("app", "addwindow", "newwindow")
mui.Set("newwindow", "open", True)
and it didn't work.. at least for me.. then i guessed that the right code should be "moai" and it worked, so I guess that the right syntax is moai.. I checked both online docs and offline doc inside hollywood and both have "mui"..

May you check this, please?

Thanks,
Davide

User avatar
airsoftsoftwair
Posts: 4392
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Newbie question about RapaGui

Post by airsoftsoftwair »

NubeCheCorre wrote:
Mon Aug 10, 2020 12:21 am
May you check this, please?
Yes, that is a typo that made its way from the MUI Royale documentation into the RapaGUI one. Fixed now.

Concerning your problem: Have you taken a look at the Dialogs example that comes with RapaGUI? I think it does exactly what you want when pressing the "Add..." button.

Of course, you can also use normal windows instead of dialogs but normal windows can't be made modal, i.e. block the app until the user is done with the dialog.

User avatar
NubeCheCorre
Posts: 77
Joined: Mon Mar 19, 2012 1:24 am
Contact:

Re: Newbie question about RapaGui

Post by NubeCheCorre »

Thanks Andreas!

Post Reply