I am new to FOX and FoxGUIb. I have found FoxGUIb very
useful and I have created an application with menus,
one of which calls a DialogBox for the user to enter
some values. After finishing the user will press OK to
save data.
Unfortunately I don’t know how to let the
DialogBox know tha tonce the OK button is pressed it
should exit. It seems I need to send message ID_ACCEPT
to some recipient (not sure which) when the button OK
is clicked? But no idea how to do that with the code
that is generated by FoxGUIb as the button is created
in a different way to what I have seen in the examples
in the web, and I have no idea how to relate them (
I'm afraid I haven't really understood the FXButton
API)
The dialog box examples I have seen do something like
the following:
@button_ok.connect(Fox::SEL_COMMAND){
lat = textfield_lat.text
lon = textfield_lon.text
heading
=textfield_heading.text #How
do I indicate that I want to accept and exit?:?
}
}
So in this last example, how do I exit the dialog when
button is clicked?
I am new to FOX and FoxGUIb. I have found FoxGUIb very
useful and I have created an application with menus,
one of which calls a DialogBox for the user to enter
some values. After finishing the user will press OK to
save data.
Unfortunately I don't know how to let the
DialogBox know tha tonce the OK button is pressed it
should exit. It seems I need to send message ID_ACCEPT
to some recipient (not sure which) when the button OK
is clicked? But no idea how to do that with the code
that is generated by FoxGUIb as the button is created
in a different way to what I have seen in the examples
in the web, and I have no idea how to relate them (
I'm afraid I haven't really understood the FXButton
API)
me neither ... there are some very hackish things that make the use
of fox toolkit not as easy as it could be.
The dialog box examples I have seen do something like
the following:
@button_ok.connect(Fox::SEL_COMMAND){
lat = textfield_lat.text
lon = textfield_lon.text
heading
=textfield_heading.text #How
do I indicate that I want to accept and exit?:?
}
}
So in this last example, how do I exit the dialog when
button is clicked?
the most simple aproach would be like this: @button_ok.connect(Fox::SEL_COMMAND){
.... @topwin.hide() # assuming that @topwin is the name of the dialogbox
}
however if your dialog box has been run modal this will not work. the
dialog box disappears but is still modal. in this case you have to
send an ID_ACCEPT message to @topwin like this:
Hi Meinrad,
Thank you very much for your help.
Where would i put the message handler: @topwin.handle(@button,
FXSEL(Fox::SEL_COMMAND,Fox::FXDialogBox::ID_ACCEPT),
nil)
Would i put it inside the button_ok.connect method?
> Dear All
>
> I am new to FOX and FoxGUIb. I have found FoxGUIb
very
> useful and I have created an application with
menus,
> one of which calls a DialogBox for the user to
enter
> some values. After finishing the user will press
OK to
> save data.
>
> Unfortunately I don't know how to let the
> DialogBox know tha tonce the OK button is pressed
it
> should exit. It seems I need to send message
ID_ACCEPT
> to some recipient (not sure which) when the button
OK
> is clicked? But no idea how to do that with the
code
> that is generated by FoxGUIb as the button is
created
> in a different way to what I have seen in the
examples
> in the web, and I have no idea how to relate them
(
> I'm afraid I haven't really understood the
FXButton
> API)
me neither ... there are some very hackish things
that make the use
of fox toolkit not as easy as it could be.
>
> The dialog box examples I have seen do something
like
> the following:
>
> # Accept
> accept = FXButton.new(buttons, "&Accept", nil,
> self, ID_ACCEPT,
>
On 12/8/06, e aldaz <ardhazes@yahoo.com> wrote:
>
>
> However the FoxGUIb creates a button doing:
>
> FX::Button.new(@verticalframe7){|w|
> @button_ok=w
> w.wdg_name='button_ok'
> w.text="Ok"
> w.width=21
> w.y=4
> w.height=21
> w.layoutHints=40
> w.x=26
> w.selector=FX::DialogBox::ID_QUIT
>
> @button_ok.connect(Fox::SEL_COMMAND){
> lat =
textfield_lat.text
> lon =
textfield_lon.text
> heading
> =textfield_heading.text
> #How
> do I indicate that I want to accept and exit?:?
>
> }
> }
>
> So in this last example, how do I exit the dialog
when
> button is clicked?
the most simple aproach would be like this: @button_ok.connect(Fox::SEL_COMMAND){
.... @topwin.hide() # assuming that @topwin is the
name of the dialogbox
}
however if your dialog box has been run modal this
will not work. the
dialog box disappears but is still modal. in this
case you have to
send an ID_ACCEPT message to @topwin like this:
hope this helps,
-- meinrad (henon)
>
> Thanks very much for your help
> Eduardo
>
___________________________________________________________
The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. Yahoo is part of the Yahoo family of brands
undefined method `FXSEL' for #<DialogBox:0x7f5e230>
I have also seen mention of using something like:
getApp().stopModal(@topwin, 1) @topwin.hide
But didn't work for me either
I have included all the code created by the FoxGUIb,
hoping it could make things clearer.
Thanks again !
Eduardo
# source generated by foxGUIb 0.7.1
class DialogBox
def initialize( parent)
construct_widget_tree( parent)
init if respond_to? 'init'
end
#unit test
if __FILE__==$0
require 'libGUIb16'
app=FX::App.new
w=DialogBox.new app
w.topwin.show(Fox::PLACEMENT_SCREEN)
app.create
app.run
end
···
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine http://uk.docs.yahoo.com/nowyoucan.html
> Hi Meinrad
>
> I have included the call you mentioned in the
funcion
> connect and i get the error:
>
> @topwin.handle(@button, FXSEL(Fox::SEL_COMMAND,
> Fox::FXDialogBox::ID_ACCEPT), nil)
>
> undefined method `FXSEL' for
#<DialogBox:0x7f5e230>
yeah, sorry, i forgot to prefix FXSEL with Fox::
like this:
On 12/9/06, e aldaz <ardhazes@yahoo.com> wrote:
nil)
-- meinrad
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine http://uk.docs.yahoo.com/nowyoucan.html