[fxruby-users] Is it possible to create a pane dynamically

Melton, Ryan rmelton at ball.com
Tue Sep 1 10:17:09 EDT 2009


Try using removeChild with the pane's parent. 

-----Original Message-----
From: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of Soumyanath Chatterjee
Sent: Tuesday, September 01, 2009 8:10 AM
To: fxruby-users at rubyforge.org
Subject: Re: [fxruby-users] Is it possible to create a pane dynamically

Hi!

Thanks to Lyle's pointer - .create method has solved the pane creation problem. But there are other problem - how do I get rid of the pane.
Multiple calls to this class keeps stacking the pane over the old one.

In C++, I would have destroyed the old object - what do I do in FXRuby?

vPane.hide - looks to be a work around; but I think this will keep the old objects in memory. Please suggest a good way to close the screen.



On Tue, Sep 1, 2009 at 3:42 AM, Lyle Johnson<lyle at lylejohnson.name> wrote:
> On Fri, Aug 28, 2009 at 6:55 AM, Soumyanath<soumyanath.c at gmail.com> wrote:
>
>> I am new to FXRuby so excuse me for this stupid question.
>
> It is not a stupid question.
>
>> I need to enter many different data and trying to create a vertical 
>> pane dynamically using response from a SQL query.
>>
>> I want these input form to appear in my main window. Created a class 
>> based on FXMainWindow.
>>
>> --------------- Code snippet ------------ class DbFace < FXMainWindow
>>    attr_writer \
>>    :title,
>>
>>  def addNew
>>    vPane = FXVerticalFrame.new(@hWnd)
>>    dTitle = FXLabel.new(vPane, at title,nil,LAYOUT_FILL_ROW)
>>  end
>>
>>  def initialize(app, pane)
>>    @hWnd = pane
>>    @hApp  = app
>>  end
>> end
>> ----------- End -----------------
>>
>> I use this class from inside my program. As:
>>
>>        book = DbFace.new(app, @frame)
>>        book.title = "Add new record"
>>        book.addNew
>>
>>
>> The new dialog fields do not show up with this. Please tell me if I 
>> am doing something wrong. Any example will be great.
>
> I think you're just leaving out a call to create() for the 
> newly-constructed widgets. What happens if you add a call to
> vPane.create() at the end of your addNew() method?
>
>    def addNew
>      vPane = FXVerticalFrame.new(@hWnd)
>      dTitle = FXLabel.new(vPane, at title,nil,LAYOUT_FILL_ROW)
>      vPane.create
>    end
>
> Let me know if that does the trick. For more background on this, see:
>
>    http://www.fox-toolkit.org/faq.html#CREATELATER
>
> Or, even better, buy the FXRuby book and read Chapter 7. ;)
>
> Hope this helps,
>
> Lyle
> _______________________________________________
> fxruby-users mailing list
> fxruby-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/fxruby-users
>



--
--
Regards

Soumyanath Chatterjee
http://www.soumya.name
Let's map the world, use http://www.wikimap.biz _______________________________________________
fxruby-users mailing list
fxruby-users at rubyforge.org
http://rubyforge.org/mailman/listinfo/fxruby-users



This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.


More information about the fxruby-users mailing list