FXVerticalFrame clearing compos

View: New views
3 Messages — Rating Filter:   Alert me  

FXVerticalFrame clearing compos

by Nataraj :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi


How do i clear the FXTextFields of a FXVerticalFrame in one go?
What is the structure that holds the components defined for the FXVerticalFrame?


regards

Nataraj
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: FXVerticalFrame clearing compos

by Jeroen van der Zijp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 11 June 2009, Nataraj S Narayan wrote:
> Hi
>
>
> How do i clear the FXTextFields of a FXVerticalFrame in one go?
> What is the structure that holds the components defined for the FXVerticalFrame?

You can find the first child of a FXComposite by calling

        child=composite->getFirst()

and subsequent siblings with:

        child=child->getNext()

until child==NULL.

Of course, no guarantee that they're FXTextFields.  I recommend:


        textfield=dynamic_cast<FXTextField*>(child);
        if(textfield){

                ...

        }

or:

        if(child->isMemberOf(&FXTextField::metaClass)){
                textfield=(FXTextField*)child;

                ...

        }


If you KNOW they're FXTextFields, you can of course omit the check and
simply use static_cast<FXTextField*>(child) instead, which is definitely
faster.



                - Jeroen
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: FXVerticalFrame clearing compos

by Joel VanderWerf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nataraj S Narayan wrote:
> Hi
>
>
> How do i clear the FXTextFields of a FXVerticalFrame in one go?
> What is the structure that holds the components defined for the FXVerticalFrame?

IIRC, you can use the #children method:

frame.children.each do |child|
   child.text = ""
end

--
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users