On Fri, Jul 10, 2009 at 1:47 PM, dave L
<dglnz@...> wrote:
Hi Meinrad,
Yes it's me again, |
hi dave, you are welcome,
I have got a wee dialogbox test and want to know what is the best way of using it as a generic popup box for when i need it.
e.g. i have a condition where only 10 characters are allowed in a textfield.
So upon the test being true
would it be better off setting up the dialog box as a class or as a sequence? |
normally you would want to generate a class in foxguib. the "sequence" generation mode is for experts ;)
I understand that FXWindow and FXDialog in FOX are of an equal footing on the object hierarchy so is this a reason why you cannot make the dialog box a child window of mainwindow?
If i wanted this type of hierarchy should i then be looking at a mdiclient ? |
if you want mdi behavior then FXMDIClient is what you need.
this is a senario of my program with which you have helped me with so far.
CRM app.
1. mainwindow from which normal user interaction is done through.
2. New customer screen (call this MDIclient1) setup
for when a new customer is to be entered - how when the user enters an account number not found in the database, how is it detected from the DB? when a nil recordset is returned. If the user made an error then they close MDIclient1 down.
3. enter more than 10 characters into textfield1 MDIclient2 appears with a suitable message & title, a button (perhaps 2 or 3 are on the form BUT only 1 is visible) thus this MDIclient2 becomes a generic dialog box that i can call passing in parameters for 1 or 2 or 3 buttons to be made visible, and with actions that can be taken dependant on the text entered or simply by having N buttons and in various positions on the window and making which ever is needed for the reason i want the dialog to appear visible thus
making the event code linking perhaps easier.
The result of this is that i have ONE file with a number of "forms" or windows easily made visible and thus cutting down the number of
other programs i call into mymainwin program (aka my event handling code for the foxGUI generated screen).
Now the other way i was wondering was ...
if you can have widgets placed inside other widgets as the snippet code below shows
# source generated by foxGUIb 1.0.0
FX::DialogBox.new(parent){|w| @dialogBox=w w.wdg_name='dialogBox' ****** lines of placement code removed ****** FX::Packer.new(@dialogBox){|w|
@packer1=w w.wdg_name='packer1'
couldn't you within a mainwindow subclass dialogbox so it is inside mainwindow? thus allowing the user to have a dialog box live within the 1 mainwindow something like.... |
no, fxruby doesn't allow that! use MDIClient for something like that. if you set a FXMainWindow as a parent of a FXDialog the dialog is a dialog that is always on top of the main window but not forced to be in a client area like in a MDIClient.
class MainWindow
def initialize(
parent) construct_widget_tree( parent) init if respond_to? 'init' end def construct_widget_tree( parent) @topwin= FX::MainWindow.new(parent){|w|
@mainWindow=w w.wdg_name='mainWindow' w.width=949
FX::DialogBox.new(@mainWindow){|w|
@dialogBox=w
w.wdg_name='dialogBox'
****** lines of placement code removed ******
FX::Packer.new(@dialogBox){|w|
@packer1=w
w.wdg_name='packer1'
Now this would make @dialogBox sit inside the mainwindow layout file.
Now currently i have Two foxGUI generated files. my original and a dialog box these in two seperate files.
This is what i have got currently all code snippet you see below is in a file called mymainwin.rb
require 'sqlite3_calls.rb' require 'monitordxlog' require 'monitorscreen'
class Fxwindow_code < MainWindow
def initialize(parent) super @mydb = Dbase.new @mydia = DialogBox end
def init @textfield1.connect(Fox::SEL_KEYRELEASE){ if textfield1.text.length == 10 then
@mydia.visible = true end @label4 = @textfield1.text }
the errors i get for the snippet above are below ( i have tried show and new in place of the .visible = true code and got errors referring to them both as being invalid - undefined method) I realise the reason is because i don't know how to make the dialog box visible or displayed at present.
If this approach is the best then how can i get it displayed?
just checked fox Rdocs and saw execute, tried it just now but it failed too.
>ruby mymainwin.rb mymainwin.rb:17:in `init': undefined method `visible=' for DialogBox:Class (NoMethodError)
from
C:/Ruby1.8/lib/ruby/gems/1.8/gems/fxruby-1.6.16-x86-mswin32-60/lib/fox16/responder2.rb:55:in `call' from C:/Ruby1.8/lib/ruby/gems/1.8/gems/fxruby-1.6.16-x86-mswin32-60/lib/fox16/responder2.rb:55:in `onHandleMsg'
from mymainwin.rb:51:in `run' from mymainwin.rb:51 >Exit code: 1
here another error for teh use of enabled
>ruby mymainwin.rb mymainwin.rb:17:in `init': undefined method `enabled' for DialogBox:Class (NoMethodError)
from C:/Ruby1.8/lib/ruby/gems/1.8/gems/fxruby-1.6.16-x86-mswin32-60/lib/fox16/responder2.rb:55:in `call' from C:/Ruby1.8/lib/ruby/gems/1.8/gems/fxruby-1.6.16-x86-mswin32-60/lib/fox16/responder2.rb:55:in `onHandleMsg'
from mymainwin.rb:52:in `run' from mymainwin.rb:52 >Exit code: 1 |
have a look at the fxruby api what methods FXDialogBox has (because all classes in foxguib are derived from corresponding fxruby classes):
http://www.fxruby.org/doc/api/
FXDialogBox#execute
FXDialogBox#show <--- inherited from FXTopWindow
in the future, please search the api first before bothering me ;)
I am sure you can see why i am asking for your input and
advice on how best to do this. I know i am poor on ruby/programming skills compared to some but I do value your input to me. and your explainations on the differences between class and sequence on the ruby generator dialoxbox would be appreciated.
note and please correct if i am wrong
from my inspection of the dialog box saved as a sequence rather than a class is that one could cut & past into a user defined events file (aka in my case the mymainwin.rb file) and run it from there. |
yes, that's the intention.
looking for to you assistance.
dave.
|
hth,
-- henon
--------------------------------------------------------------
http://www.eqqon.com/index.php/GitSharp
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users