[Gambas-user] Emulating wizard Back/Next navigation

Fabien Bodard gambas.fr at ...626...
Sat Dec 13 08:20:56 CET 2008


forward need to be hardcoded, backward need to use an object array and
the function pop/push


and it will work with that.

so

1->2->3
         ->4

it's 2 who know if you must or not go to the 3 or 4 so the next button
need to drive that statiquely.

it may work in all case.

when next is selected it store the current form in an array



the main windows own the prev/next button

you need to have a common fonction in your child windows, Named for
exemple GetNext, that return the next Windows and in fact

Public $arrPrev as new Object[]
Public $oCurrentChild as Object

Public sub Next_Click()
dim o, oTmp as Object

'Get the next One

sTmp =$oCurrentChild.GetNext()

'Is this form already opened ?
'if true it may have no been closed to preserve entries
For each o in Panel

  if Object.Type(o) = sTmp then oTmp = o

next


'strore the previous
  $arrPrev.Push(oCurrentChlid)

'Select or create the form
if not isNull(oTmp) then
    $oCurrentChild = Object.New(sTmp, Panel)
    $oCurrentChild.Visible = True
else
   $OCurrentChild = oTmp
endif

'Push to the foreground
  $oCurrentChild.Raise()

end



Public sub Prev_Click()

  $oCurrentChild =  $arrPrev.Pop
  $oCurrentChild.Raise()

end



in all your children you add :

Public Fonction  GetNext() as String

  'simply return the name of the next form as a string (classname)
  return "frmNext"

end




so it's not tested but it will work

Regards
Fabien Bodard



2008/12/12 M0E Lnx <m0e.lnx at ...626...>:
> My idea was a little different, but I think I got it....
>
> In my idea, I use a panel or workspace in FMain as a host for the other windows.
>
> The navigation is always handled from FMain, and not from each child
> window, which is what makes it complicated for me.
> I had created a model that used the object[] for reverse navigation
> and the logical forward sequence is defined by the child windows, and
> partly from a pre-defined default path. I'm getting satisfactory
> results, but I was trying to see if there was a better way to do it
>
>
>
> On Fri, Dec 12, 2008 at 11:54 AM, nando <nando_f at ...951...> wrote:
>> To remove the complicatedness of going from 2 to 4 or 5, skipping 3, you
>> could implement it this way.
>> Let's say you're in Form2 and when NEXT is pressed, it is determined that
>> the next step is 5.  You should have two global vars (called 'FROM' and 'DEST')
>> set FROM 2 and set DEST to 5. Then perform the code (in Form2) to next the next
>>  form (FORM3) but it checks to see if it matches DEST. This case it doesn't.
>> Form3 will run code for NEXT to Form4.  Each form performs the same
>> type of operation.  Each form should have a local var to remember the FROM
>> when the thread reaches there to know where to go BACK to.  In this case
>> when in Form5, it would save locally that it came from 2. If Form5 needs to
>> go BACK, it will use it's local copy of FROM to know to set DEST, then
>> run the back code (to Form4, then Form3, then Form2).
>> Everything works sequencially forwards and backwards and each form has similar
>> tests and methods to perform doing it.
>>
>>
>>
>> ---------- Original Message -----------
>> From: Dominique SIMONART <simonart.dominique at ...11...>
>> To: mailing list for gambas users <gambas-user at lists.sourceforge.net>
>> Sent: Fri, 12 Dec 2008 04:11:24 +0100
>> Subject: Re: [Gambas-user] Emulating wizard Back/Next navigation
>>
>>> M0E Lnx a écrit :
>>> > I just can't seem to completely wrap my mind around this one.
>>> >
>>> > It really doesn't matter if i return to the same state or not... as
>>> > long as I return there.
>>> >
>>> > it gets complicated when for instance, you go in a sequence from 1, 2,
>>> > 3 then you back up to 2... change something in 2 that now makes you
>>> > skip 3 and jump to 4 or 5.
>>> >
>>> > On Thu, Dec 11, 2008 at 3:40 PM, Simonart Dominique
>>> > <simonart.dominique at ...11...> wrote:
>>> >
>>> >> M0E Lnx a écrit :
>>> >>
>>> >>> Exactly.
>>> >>>
>>> >>> The forward navigation depends on the user input, so it could jump
>>> >>> from Form1 to Form3 and then to Form2 ans do on...
>>> >>>
>>> >>> So if we leave a footprint in the array, I think it *should* be easy
>>> >>> to reverse the process indeed sort of like an "undo" process.
>>> >>>
>>> >>> But I'm not sure exactly what the best way to do the reverse is...
>>> >>> should I index the array? or try to find the current form in the array
>>> >>> and then just use the current forms.index in the array - 1 ?
>>> >>>
>>> >>> I've been fidling with this for a while... and it works perfecly in my
>>> >>> mind... but can't really make it work on the IDE :(
>>> >>>
>>> >>> On Thu, Dec 11, 2008 at 2:23 PM, Simonart Dominique
>>> >>> <simonart.dominique at ...11...> wrote:
>>> >>>
>>> >>>> M0E Lnx a écrit :
>>> >>>>
>>> >>>>> I have to say, the array idea makes more sense to me, simply because
>>> >>>>> otherwise, it'll be hard to tell the next and back buttons which sub
>>> >>>>> to run.
>>> >>>>>
>>> >>>>> I have tried an array, but object array rather than string array.
>>> >>>>>
>>> >>>>> The idea is that every form that gets opened leaves a footprint in
>>> >>>>> this object array
>>> >>>>> for instance, the form's open() event would have something like this
>>> >>>>>
>>> >>>>> IF ArrNav.find(me) = -1 THEN ArrNav.Add(me)
>>> >>>>>
>>> >>>>> this makes reverse navigation possible by indexing the array or a
>>> >>>>> similar method. However, I am not able to work out all the bugs
>>> >>>>> resulting from this because it gets crazy when you try to move back,
>>> >>>>> then forward... then back... ends up in a crash almost every time
>>> >>>>>
>>> >>>>> Can someone work out a sample I can use?
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>> On Thu, Dec 11, 2008 at 6:20 PM, nando <nando_f at ...951...> wrote:
>>> >>>>>
>>> >>>>>> Perhaps the following ideas...
>>> >>>>>> Every step in the wizard has an associated form for whatever it does for that step.
>>> >>>>>> Every form has a SUB for 'backwards' and 'forwards so that
>>> >>>>>> when NEXT is clicked, the forwards code runs, which is whatever
>>> >>>>>> is required for moving to the next form (ie: perform work, verify info,
>>> >>>>>> hide form, the activate 'next' form)
>>> >>>>>> when BACK is clicked, the backwards code runs, which is whatever to
>>> >>>>>> undo this step (if needed), hide form, activate 'back' form.
>>> >>>>>> Each form knows how to go back one step, and go forward one step.
>>> >>>>>> You would have to tell the Next and BAck buttons which forwards and backwards
>>> >>>>>> sub to run...you could place in NEXT.tag and BACK.tag the form or info required
>>> >>>>>> to properly run the correct code.  This would be modular so each form takes
>>> >>>>>> care of things.
>>> >>>>>> Or, the list of wizard steps could be in a global string array with the name
>>> >>>>>> of the form and simply step through the index.
>>> >>>>>> -Fernando
>>> >>>>>>
>>> >>>>>>
>>> >>>>>> ---------- Original Message -----------
>>> >>>>>> From: "M0E Lnx" <m0e.lnx at ...626...>
>>> >>>>>> To: "mailing list for gambas users" <gambas-user at ...629...ge.net>
>>> >>>>>> Sent: Wed, 10 Dec 2008 20:39:45 +0000
>>> >>>>>> Subject: [Gambas-user] Emulating wizard Back/Next navigation
>>> >>>>>>
>>> >>>>>>
>>> >>>>>>> So I set myself to create a program that acts like a wizard, but chose
>>> >>>>>>> not to use the wizard object because well, there is just too many
>>> >>>>>>> variables here, and there is more than one way to get to the end,
>>> >>>>>>> Depending on user input.
>>> >>>>>>>
>>> >>>>>>> So what I did was create a navigation tool bar at the bottom of FMain
>>> >>>>>>> this toolbar has a BACK, EXIT, and a NEXT button.
>>> >>>>>>>
>>> >>>>>>> I have a workspace object above it which will host other forms via
>>> >>>>>>> each forms .Reparent method.
>>> >>>>>>>
>>> >>>>>>> Can anyone suggest a way to make reverse and forward navigation on such a setup?
>>> >>>>>>>
>>> >>>>>>> I have created a small project what I'm trying to do... See attachment
>>> >>>>>>>
>>> >>>>>>> Any help is appreciated
>>> >>>>>>>
>>> >>>>>>> Thanks
>>> >>>>>>>
>>> >>>>>> ------- End of Original Message -------
>>> >>>>>>
>>> >>>>>>
>>> >>>>>> ------------------------------------------------------------------------------
>>> >>>>>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
>>> >>>>>> The future of the web can't happen without you.  Join us at MIX09 to help
>>> >>>>>> pave the way to the Next Web now. Learn more and register at
>>> >>>>>> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>>> >>>>>> _______________________________________________
>>> >>>>>> Gambas-user mailing list
>>> >>>>>> Gambas-user at lists.sourceforge.net
>>> >>>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>> >>>>>>
>>> >>>>>>
>>> >>>>> ------------------------------------------------------------------------------
>>> >>>>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
>>> >>>>> The future of the web can't happen without you.  Join us at MIX09 to help
>>> >>>>> pave the way to the Next Web now. Learn more and register at
>>> >>>>> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>>> >>>>> _______________________________________________
>>> >>>>> Gambas-user mailing list
>>> >>>>> Gambas-user at lists.sourceforge.net
>>> >>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>> I think BACK has to be only an "undo" process, and NEXT is
>>> >>>> the logical next state depending on the datas already
>>> >>>> collected. If 2 forms could result from an actual status,
>>> >>>> then you have to review the logical chain.
>>> >>>>
>>> >>>> my two cents :)
>>> >>>> Dominique Simonart
>>> >>>>
>>> >>>>
>>> >>>> ------------------------------------------------------------------------------
>>> >>>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
>>> >>>> The future of the web can't happen without you.  Join us at MIX09 to help
>>> >>>> pave the way to the Next Web now. Learn more and register at
>>> >>>> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>>> >>>> _______________________________________________
>>> >>>> Gambas-user mailing list
>>> >>>> Gambas-user at lists.sourceforge.net
>>> >>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>> >>>>
>>> >>>>
>>> >>> ------------------------------------------------------------------------------
>>> >>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
>>> >>> The future of the web can't happen without you.  Join us at MIX09 to help
>>> >>> pave the way to the Next Web now. Learn more and register at
>>> >>> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>>> >>> _______________________________________________
>>> >>> Gambas-user mailing list
>>> >>> Gambas-user at lists.sourceforge.net
>>> >>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>> >>>
>>> >>>
>>> >>>
>>> >> The simpler is often the better :) May be you could write
>>> >> two procedures sort of PUSH and POP routines. Since the
>>> >> datas to keep should be limited enough, the better is to
>>> >> store all of them at each step with the last Object/form
>>> >> name. Since all data are implicitly correct (they passed
>>> >> correctly the preceeding step!) this is just a matter of
>>> >> display the form and to restore all the variables with the
>>> >> POPed values without control. This suppose of course the
>>> >> BACK could only reverse step by step. If you add something
>>> >> else in the BACK process, you could not be sure to return on
>>> >> the same initial state.
>>> >>
>>> >> Dominique Simonart
>>> >>
>>> >>
>>> >> ------------------------------------------------------------------------------
>>> >> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
>>> >> The future of the web can't happen without you.  Join us at MIX09 to help
>>> >> pave the way to the Next Web now. Learn more and register at
>>> >> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>>> >> _______________________________________________
>>> >> Gambas-user mailing list
>>> >> Gambas-user at lists.sourceforge.net
>>> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>> >>
>>> >>
>>> >
>>> > ------------------------------------------------------------------------------
>>> > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
>>> > The future of the web can't happen without you.  Join us at MIX09 to help
>>> > pave the way to the Next Web now. Learn more and register at
>>> > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>>> > _______________________________________________
>>> > Gambas-user mailing list
>>> > Gambas-user at lists.sourceforge.net
>>> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>>> >
>>> >
>>> >
>>> Well, here is a very dirty tentative to show what could be done.
>>> I don't really tested all the cases and it is surely not robust too!
>>>
>>> I take 5 forms, each of one with a checkbox to simulate different user
>>> input and 3 buttons, Back, Next and Cancel
>>> the chaining is not totally linear as I understand your wizard is
>>> The "stack" is a Gridview (sort of static array bidimensional) wich I
>>> display on the main form after all the steps
>>> the first column is the tag of the active form, and the others give the
>>> status of the 5 checkboxes
>>>
>>> hope this help
>>> Dominique Simonart
>> ------- End of Original Message -------
>>
>>
>> ------------------------------------------------------------------------------
>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
>> The future of the web can't happen without you.  Join us at MIX09 to help
>> pave the way to the Next Web now. Learn more and register at
>> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list