Page 1 of 2
ActivePage
Posted: Sun Jan 27, 2013 12:28 pm
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.
Re: ActivePage
Posted: Tue Jan 29, 2013 5:19 pm
by airsoftsoftwair
Hmm, simply doing a
Code: Select all
mui.Set("pagegroup", "activepage", <index of page>)
doesn't work?
Re: ActivePage
Posted: Tue Jan 29, 2013 6:21 pm
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"
....
Re: ActivePage
Posted: Wed Jan 30, 2013 5:26 pm
by airsoftsoftwair
You need to set the "ActivePage" attribute on the <register> object, not on the <vgroup> object.
Re: ActivePage
Posted: Wed Jan 30, 2013 6:57 pm
by djrikki
Excellent, thanking you.
Re: ActivePage
Posted: Wed May 06, 2015 10:20 pm
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?
Re: ActivePage
Posted: Fri May 08, 2015 4:10 pm
by bitRocky
You don't need to get the active page first, just set the ActivePage to MUIV_Group_ActivePage_Next/Prev/First.
Re: ActivePage
Posted: Fri May 08, 2015 5:51 pm
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
Re: ActivePage
Posted: Fri May 08, 2015 6:57 pm
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")
Re: ActivePage
Posted: Fri May 08, 2015 9:38 pm
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.