[fxruby-users] dialog.execute vs dialog.show

Harold Worby H.Worby at Kinsey.Com
Mon Mar 21 11:04:51 EST 2005


-----Original Message-----
From: Lyle Johnson [mailto:lyle at knology.net] 
Sent: Monday, March 21, 2005 8:18 AM
To: Harold Worby
Cc: fxruby-users at rubyforge.org
Subject: Re: [fxruby-users] dialog.execute vs dialog.show
<Snip>
>> I tried to use FXEvent.win_y in the trees event code to get the 
>> coordinate
>> of the event (close enough) but get a runtime error:
>> 'undefined method `win_y' for Fox::FXEvent:Class (NoMethodError)'

>FXEvent#win_y is an instance method, not a class method. That is, you 
>need to have an FXEvent object lying around and call its win_y() method

>to get the y-coordinate.

How would one create FXEvent object that references a widgets events? I
mean in:

    tree= FXTreeList.new(@group1, 0, nil, 0,...)
    tree.connect(SEL_CLICKED  ) do |sender, selector, ptr|
        y=myFXEvent.win_y
        itemselect(sender, selector, ptr,y)
      end

How would you declare the myFXEvent object. As part is the application,
the widget, or in the event routine?

<Snip>

>> Lastly in this code I try to set the FXTextField target to be it's 
>> parent
>> dialog window and send a FXDialogBox::ID_CANCEL when it is ckicked to

>> close
>> the dialog. Why doesn't this work?

>I don't think I understand this at all. You're creating a dialog box 
>that contains a text field (which is used to allow the user to enter 
>and edit a line of text), but you want the dialog box to close as soon 
>as the user clicks inside that text field?


The idea is when the user to clicks on a leaf item a read only text box
appears over the top of it displaying more detailed information about
the item. Then when the user clicks again the text box goes away.
I.E.
    dlg =
FXDialogBox.new(@group1,"FileInfo",DECOR_BORDER,x,y,w,h,2,2,2,2,0,0)
    textbox=FXTextField.new(dlg, 200,
dlg,FXDialogBox::ID_CANCEL,TEXTFIELD_READONLY,2,2,w-4,h-4,0,0,0,0)
    textbox.text=item.data.to_s
    ...

P.S.
I now have updated to v1.5.
Thanks for the help.



More information about the fxruby-users mailing list