[Gambas-user] How do I delete a control on scrollview the correct way?

Daniel Campos dcamposf at ...626...
Tue Jun 6 14:28:32 CEST 2006


I'm not sure, but may be the control is not really deleted until the even
loop happens, so you should add a WAIT instruction after the deletion. May
be it helps...

By the way, as "Delete" is a method, may be the "Delete()" syntax is more
ellegant, even if Gambas allows to use the first one.

Daniel


2006/6/6, Ron Onstenk <ronstk at ...239...>:
>
>
> on the forma  Scrollview1 as SVFrames
>
> public function wsadd()
>   fra = NEW Frame(SVFrames) AS "WSfra"
>   lbl = NEW Label(fra)
>   btn = NEW button(fra)
>   tgb = NEW ToggleButton(fra)
>   lv = NEW ListView(fra) AS "WStbl"
> end
>
>
> public wsdel(fra as frame)
>   PRINT "fra.id="; fra.Id
> PRINT "children.count="; fra.Children.Count ' =4
>   FOR EACH ct IN fra.Children 'remove controls from frame
>     ct.Delete  '<--- does not work
>   NEXT
>   fra.Delete  '<--- does not work
> PRINT "children.count="; fra.Children.Count 'is still 4
>
>   fra.Enabled = FALSE
>   showfra
> end
>
>
> for both prints I get 4 children. More stupid is the second print.
> If the frame.delete is done it can't have children anymore.
>
> In the scrollview the count of frames add with wsadd
> stay the same after delete.
> It only grows with wsadd but never lower with wsdel.
>
> in showfra is the next WsTableGetFra used
> after wsdel has run the frame is not visible anymore
> but it is also not realy go to nothing
>
>
> PUBLIC FUNCTION WsTableGetFra() AS Object[]
>   DIM ctl AS Control
>   DIM fra AS Frame
>   DIM objs AS NEW Object[]
>
>   FOR EACH ctl IN SVFrames.Children
>     IF object.Type(ctl) = "Frame" THEN
>       fra = ctl
> PRINT "fra "; fra.tag <----- not changed after delete
>
>       IF object.IsValid(fra) THEN  '<--- stay valid after fra.delete
> PRINT "isValid "; fra.tag 'always
>
>         IF NOT IsNull(fra) THEN '<--- should be null but isn't
> PRINT "NOT IsNull "; fra.tag    '<------never
> PRINT "children.count="; fra.Children.Count '<--- stay at 4
>           IF fra.Enabled THEN objs.Add(fra)
>         ENDIF
>       ENDIF
>     ENDIF
>   NEXT
>
> end
>
> I have only a workaround with the frame.enabled but this
> should be imposible.
>
> Someone a tip what is wrong?
>
> Ron
>
>
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20060606/97950209/attachment.html>


More information about the User mailing list