[FXRUBY] FXProgressBar and SEL_COMMAND

Hello all,

I have 2 FX questions :

. is it possible to hook a method on a progressbar so as to get an event
when the users clicks on it ?

How can i proceed if i want to run from my FXMainWindow another
FXMainWindow ? This doesn’t look to be possible at all. So I suppose my
base window must extend another FXWindow class. Which one is as easy to
use as the FXMainWindow ?

My application is an image browser and, at some point, i’d like to
re-intance another intance of my application with a slightly different
constructor to allow the user to select an image. I’d like to avoid
rewriting most of my image browser…

Good evening,
TIA,

···


Pierre Baillet
If you want the answers, you better get ready for the fire
System of a Down

Pierre Baillet wrote:

Is it possible to hook a method on a progressbar so as to get an event
when the users clicks on it?

Yes. An FXProgressBar is usually just used for display purposes (like a
label) and so it’s not normally enabled for user events. In order to get
messages for mouse clicks, then, you first need to enable it:

 aProgressBar.enable

After that, you can “listen” for, say, the SEL_LEFTBUTTONRELEASE message,

 aProgressBar.connect(SEL_LEFTBUTTONRELEASE) {
   puts "Click!"
 }

How can i proceed if i want to run from my FXMainWindow another
FXMainWindow ? This doesn’t look to be possible at all.

True; FOX 1.2 will support multiple main windows in an application, but
FOX 1.0 does not.

So I suppose my base window must extend another FXWindow class.
Which one is as easy to use as the FXMainWindow?

You might try subclassing FXDialogBox. Like FXMainWindow, it is derived
from FXTopWindow (the base class for all top-level windows).

My application is an image browser and, at some point, i’d like to
re-intance another intance of my application with a slightly different
constructor to allow the user to select an image. I’d like to avoid
rewriting most of my image browser…

This doesn’t sound like something that warrants instantiating a whole
new main window object, but of course I guess it depends on how the
application is structured. For the dialog box (or whatever it is) that
the user interacts with to select a new image, is it that you’re trying
to provide some kind of “preview” of the image to be loaded? Can’t you
just embed an FXImageView widget in there somehow? Please take a look at
the imageview.rb example program for an idea of how to use the
FXImageView widget, it’s pretty easy.

Hope this helps,

Lyle

Hello,

Thanks for all the tips Lyle, your answers are, as always, perfect :slight_smile:

This doesn’t sound like something that warrants instantiating a whole
new main window object, but of course I guess it depends on how the
application is structured. For the dialog box (or whatever it is) that
the user interacts with to select a new image, is it that you’re trying
to provide some kind of “preview” of the image to be loaded? Can’t you
just embed an FXImageView widget in there somehow? Please take a look at
the imageview.rb example program for an idea of how to use the
FXImageView widget, it’s pretty easy.

just to add some precision to what i’m doing. This is an image browser
which allows you to select an image for any folder. So you’re browsing
your pictures and then you say “hey i’d like to put a picture on this
folder”, click on a button and a new image browser (which lets you
choose one of the picture inside this folder) enables you to choose a
picture for your folder. You select your picture, click on a button and
this second browser disapear. Hence the second instantiation.

Hope my english is good enough to explain this :slight_smile:

···

On Wed, Mar 19, 2003, Lyle Johnson wrote:

Pierre Baillet
Je pompe donc je suis.
Devise Shadok