FoxGUIb/FAQ

From eqqon

(Difference between revisions)
Jump to: navigation, search
m
m (What is the best way to seperated generated code from manual code?)
Line 52: Line 52:
  end
  end
-
;extending the foxguib class
+
 
 +
;1) extending the foxguib class:
done_with_foxguib.rb:
done_with_foxguib.rb:
  require "_done_with_foxguib"
  require "_done_with_foxguib"
Line 61: Line 62:
  end
  end
-
;deriving from the foxguib class
+
 
 +
;2) deriving from the foxguib class:
done_with_foxguib.rb:
done_with_foxguib.rb:
  require "_done_with_foxguib"
  require "_done_with_foxguib"

Revision as of 19:16, 5 October 2007

Contents

Frequently Asked Questions

What is foxGUIb?

FoxGUIb is an interactive GUI builder and code generator for Ruby. It is the perfect tool for newbies to find out how the Fox-Toolkit works without reading the API docs. It is of course also a tool for professionals because it saves you a lot of typing and "build-cycles" when tweaking user interface look-and-feel.

Is there a foxGUIb tutorial?

Mike Parr has written a small users guide targeted at beginners.

Is foxGUIb still actively developed?

No. At the time beeing the author is quite busy trying to start his own business. Therefore there is no time left for foxGUIb. If you would like to push foxGUIb beyond what it is now please send a mail to <meinrad dot recheis at gmail dot com>.

How can I help?

If you have written any useful extensions to foxGUIb / libGUIb or corrected any bugs please send in the patches.

foxGUIb crashes! What should I do?

First check out the file log.txt at foxGUIb's directory. It may contain useful information (i.e. exception backtrace) that may help you to solve your problem. If not, you are welcome to send in the file to <meinrad dot recheis at gmail dot com> and ask for help.

I found an annoying little bug

Please fix it and send me the patch or if you are not able to do it you may send a bug report to <meinrad dot recheis at gmail dot com>.

Why does foxGUIb change my x, y, with or height values

Actually it does not. The underlying fox-toolkit overwrites these values. Use the layout hints LAYOUT_FIX_WIDTH, LAYOUT_FIX_HEIGHT, LAYOUT_FIX_X, LAYOUT_FIX_Y or simply LAYOUT_EXPLICIT which is a combination of all the previous. You need to set such layout hints in order to preserve the x, y, width and height values. All other kinds of layout hints will ignore them.

I get thousands of warnings when foxGUIb starts

This is a bug which is exhibited by a specific combination of FXRuby nd Ruby version (FXRuby 1.6.?). The bug has already been fixed. It should not happen if you update to the latest Ruby / FXRuby version. If this is not possible you can work around by inserting the statement $VERBOSE=nil at the very first line in foxGUIb's source.

foxGUIb crashes when loading a layout

Unfortunately foxguib sometimes crashes when opening files because it tries to open a relative path like this ../../c:/file.rbin. I really should fix that soon. In the meantime, please set foxGUIb's working directory to the directory where your *.rbins reside and loading should work.

The height of the MainWindow is off by about -40px in the generated script

The main window size is fine in foxGUIb but when the exported Ruby code is executed, the main window is about 40 pixels too small in height. This is a bug in the toolkit! The read value is not the same as the set value for a main window. To work around manually resize the window after showing it.

How do I exit a modal Dialog?

Assume that dialog is your dialogbox and button is the OK or Accept button:

button.connect(Fox::SEL_COMMAND){
  dialog.handle(button, Fox::FXSEL(Fox::SEL_COMMAND, Fox::FXDialogBox::ID_ACCEPT), nil)
}

I am trying to write some event handlers and get an error ...

... like "uninitialized constant MyClass::SEL_COMMAND (NameError)"

Either prefix all of FXRuby's constants with Fox (like this: Fox::SEL_COMMAND) or include Fox at the beginning of your script.

Is it possible to skin the Fox-Toolkit?

No, it is not. However it is possible to do quite impressive design just with the color settings of widgets. foxGUIb's own GUI proves that

What is the best way to seperated generated code from manual code?

First of all, you should never make manual corrections to foxGUIb generated files because this would make regeneration of the code very destructive. The correct way is to seperate generated code and manual extensions in two different files. There are two main ways to do this in Ruby. Assume you have generated a class called DoneWithFoxGUIb:

_done_with_foxguib.rb:

class DoneWithFoxGUIb
# ... foxguib generated code here. do not edit!
end


1) extending the foxguib class

done_with_foxguib.rb:

require "_done_with_foxguib"
class DoneWithFoxGUIb
 def init
   # ... your extension code here. The init method gets called if it exists.
 end
end


2) deriving from the foxguib class

done_with_foxguib.rb:

require "_done_with_foxguib"
class MyDoneWithFoxGUIb < DoneWithFoxGUIb
def initialize(*args, &block)
   super
   # ... your code here
 end
end

What is libGUIb?

LibGUIb is the library behind foxGUIb which is needed by the generated sources. LibGUIb contains facades (less complicated interfaces) for every widget, extends widgets with convenience methods and adds some handy tools.

May I redistribute libGUIb with my programs?

Yes. LibGUIb has been packed into only one file for exactly this purpose. You may place libGUIb-1x.rb together with your sources or redistribute the installable libGUIb package.