ActivePage

Discuss GUI programming with the MUI Royale plugin here
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

ActivePage

Post by djrikki »

Hi Andreas,

I require Next and Previous buttons in my GUI, and also I need to reset the ActivePage back to 0 when a window is re-opened as MUI remembers which Page was last left open.

Please can you give a simple example of how to use Group.ActivePage as I have been unsuccessful, e.g. two buttons with Previous and Next.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: ActivePage

Post by airsoftsoftwair »

Hmm, simply doing a

Code: Select all

mui.Set("pagegroup", "activepage", <index of page>)
doesn't work?
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: ActivePage

Post by djrikki »

I don't think I have the correct XML implementation of this at all.. I don't have a pagegroup as such I just based my code around Pages.xml in the examples folder.

Let me paste some code in...

XML Structure:

Code: Select all

        ....
	<window title="AmigaOS Appstore - Sign up for an account with Jack" muiid="APSU" id="APSU" notify="closerequest" sizegadget="false" open="false">
		<vgroup spacing="20">		
		<register>
			<vgroup id="signup-page1" title="Quick Questionnaire">
                                ....
				<hgroup>
				<button id="signup-cancel" hichar="c" controlchar="c" notify="pressed">\33A[78] Cancel</button>
				<button id="signup-next" hichar="n" controlchar="n" notify="pressed">\33A[162] Next Page</button>
				</hgroup>
                                ....
			</vgroup>
			<vgroup title="Create an Account">
                                ....
				<hgroup>
				<button id="signup-cancel2" hichar="c" controlchar="c" notify="pressed">\33A[78] Cancel</button>
				<button id="signup-previous" hichar="p" controlchar="p" notify="pressed">\33A[159] Previous Page</button>
				<button id="signup-doit" hichar="s" controlchar="s" notify="pressed">\33A[421] Sign Up</button>
				</hgroup>
                                ....
			</vgroup>
		</register>
		</vgroup>
	</window>
        ....
Hollywood:

Code: Select all

		Case "signup-cancel" ;; APP STORE SIGN UP WINDOW
	    	    	mui.Set("APLG","sleep",false)
	      	    	mui.Set("APSU","open",False)
	      	    	
		Case "signup-cancel2"
	    	    	mui.Set("APLG","sleep",false)
	      	    	mui.Set("APSU","open",False)
	      	    	
	      	    Case "signup-next"
	      	    	mui.Set("signup-page1","activepage",1)
	      	    	
	      	    Case "signup-doit"
                    ....
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: ActivePage

Post by airsoftsoftwair »

You need to set the "ActivePage" attribute on the <register> object, not on the <vgroup> object.
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: ActivePage

Post by djrikki »

Excellent, thanking you.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: ActivePage

Post by lazi »

Requesting the active page with mui.get("register","ActivePage") gives back a string for the first page ("First") and a number for the rest.
It would be easier to handle if the result could only be one type.

I have to check the type before using it in an expression.

Would it be change in the future?
bitRocky
Posts: 120
Joined: Fri Nov 14, 2014 6:01 pm

Re: ActivePage

Post by bitRocky »

You don't need to get the active page first, just set the ActivePage to MUIV_Group_ActivePage_Next/Prev/First.
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: ActivePage

Post by lazi »

Sorry I don't know what is MUIV_Group_ActivePage_Next/Prev/First.

The problem is that the following is not working because the switch can't be numeric and string in the same time:

Code: Select all

	   Switch mui.get("register","ActivePage")		
                Case "First":
                        DebugPrint("first")
                Case 1:
					 Debugprint("second")
		Case 2:
                        DebugPrint("third")
	EndSwitch                                
However found a simple solution:

Code: Select all

	    Switch Val(mui.get("register","ActivePage"))
					
                Case 0:
                        DebugPrint("first")
                Case 1:
                        Debugprint("second")
		Case 2:
                        DebugPrint("third")
	EndSwitch                                
bitRocky
Posts: 120
Joined: Fri Nov 14, 2014 6:01 pm

Re: ActivePage

Post by bitRocky »

If you use the special values, you don't need to get the active page first!

The special values are named differently in MUI-Royale, use just "First", "Next", "Prev", etc, see http://www.hollywood-mal.com/docs/html/ ... ePage.html

You simply use it like this:
mui.Set("register", "activepage", "Next")
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: ActivePage

Post by lazi »

You simply use it like this:
mui.Set("register", "activepage", "Next")
Thanks for your answer, but as you can see in my previous post I am using mui.get, not mui.set. I wanted to read which register panel the user selected last time.
Post Reply