[Gambas-user] Problem switching forms on embedded application
Ron Onstenk
ronstk at ...239...
Thu Jun 5 23:54:28 CEST 2008
On Thursday 05 June 2008, M0E Lnx wrote:
> Ron is exactly right...
> Checkout the application itself at http://vasmcc.googlecode.com
>
> it all works right, when the child application (the one embedded into
> the main gui) consists of only one form
>
>
>
> On Thu, Jun 5, 2008 at 9:42 AM, Ron Onstenk <ronstk at ...239...> wrote:
> > On Wednesday 04 June 2008, Benoit Minisini wrote:
> >> On mercredi 04 juin 2008, M0E Lnx wrote:
> >> > After more testing, I have another problem here...
> >> >
> >> > The switching works now when reparenting forms into a host form via a
> >> > panel container
> >> > But when this form that hosts the other forms is embedded into another
> >> > program using am embedder object, it doesnt work
> >> >
> >>
> >> Please be more explicit, or, better, send a project that shows the bad
> >> behaviour.
> >>
> >> Regards,
> >>
> >
> > When I understand correct it is something like the mandrake control center.
> >
> > MCC opens also other forms inside the main application and you _quit_
> > the (sub)form to go back to the main form (window).
> >
> > The extra for MOE Lnx is one of the main selections does the job with
> > 2 forms instead of one and he need a way to switch between the two (sub)forms.
> >
> > Ron the I'st :)
> >
OK
My idea to it is to make a module that opens the main form.
Using the embeder two times, one with the first and the the other with the second vPanel.
Switching the visibility by calling a function in the main module from the vPanels each
for this special case and use .Visible/.Show on the vPanel1 for the others.
The handling for the both panels must be done from outside the vPanels
module mainmod:
public alldone as boolean = false
public bPanel1 as boolean = false
public bPanel2 as boolean = false
public vPanel1 as form
public vPanel2 as form
public frmMain as form
vPanel1 = new form1
vpanel1 = new form2
while not alldone
vPanel1.Hide ' the right reference to the vPanels or embedder object in your code :)
vPanel2.Hide ' if you need this
if bPanel1 then
frmMain.reparent(vPanel1)
vpanel1.embeded = true
vPanel1.show
end if
if bPanel2 then
frmMain.reparent(vPanel2)
vpanel2.embeded = true
vPanel2.show
endif
wend
in the vPanel forms:
Public embeded as boolean = false
public sub Form_Activate()
end sub
public sub Button1_Click()
' check if open is done in frmMain or as standalone
if embeded then
mainmod.bPanel1 = false
mainmod.bPanel2 = true
endif
end sub
public sub ButtonDone_Click()
mianmod.alldone = true
end sub
vPanel1 set mainmod.bPanel1 to false on start and mainmod.bPanel2 to true with the button_click
Same but oposite numbers for the other panel, now you can switch between these.
If all stuff is done set somewhere mainmod.alldone = true and all go back to
initial state, as the while loop ends by this.
I do not know what .reparent does exactly atm but my feeling tels me the reparent
lines must be 'vPanel1.reparent(frmMain)' as setting the frmMain as parent for vPanel.
As I read it (the example code) now it say do set vPanel as parent for frmMain.
The main point is you should switching the panels/forms from outside those panels/forms
using a global main module/class or inside the code of the frmMain and not try to do
from inside the vPanels/subforms.
Hope this will help a bit.
Ron the I'st
More information about the User
mailing list