[fxruby-users] Tabbook tabitem controls

dave L dglnz at yahoo.com
Sun Oct 25 06:06:13 EDT 2009


(note - I use foxGUIb for the GUI placement of controls)

had a an issue with the tabbed books control - namely after working on the 1st tab for most of the time i am now at a point where i can move onto the 2nd tab.

To reduce the amount of code sitting inside init of my event handling program i moved a lot of methods i'd written to another file.

I then proceeded to work on my 2nd tab with regards to creating the event hooks, BUT found that event my calls to 
another file that had worked perfectly failed! plus my calls to methods in my newly created file failed.

but when i got back to my 1st tab things worked again - NO PROBLEMS NO CRASHES! even calls to methods within the same file as my event code failed.

All these said that there was no method...

Tonight i added these lines...

#@PStabitem2.shown = true
#@PStabitem2.enabled = true
#@PStabitem2.visible = true

then things started to work, so i uncommented a method i had created and things worked, so i then copied the code and put them in another file (one i created when i started work on the 2nd tab) and the calls passed no problems.

So as an exercise I commented each line above to see what the change was but the code worked even with all 4 lines commented as i show then above the code works.

what gives?

I actually created another file deleting all references the controls etc associated with the 1st tab.
Even this didn't help my problems and I'm wondering if there is a "bug" that isn't mentioned in the API?

I mean I would have thought that if one clicks on a tab then within the code it would have a method at least to say activate (mean although you see the controls they need some primer work done so they act as expected).

If anyone can give me an explanation on why I've had this problem I'd be grateful.
I've googled, api'd forumed for a week now any only got it going by a fluke!

Also i can't use any of the codes in keys.rb.

wanting to use function keys like F11 and F9 but i cannot do this as expected...

   if keycode == KEY_F9          Do know that the keycode is an error but i didn't know at first.
     do something

Now i had come across a posting from Lyle saying you used event.code to trap the keypress value.
so i tried doing a puts "key pressed = #{event.code} was" type statement but it failed with errors

I do understand foxGUIb hasn't got the best documentation but would have thought this would've been somewhere in the fxruby forums before now.

Henon has helped be over this problem (but i cannot detect F key presses) in so far as i have this....

  if event.code = '97'
    do something - I cannot trap with KEY_a or any other constant in KEYS.rb
    F keys - I use theinteger values and use them in code - not the best.

again WHY?

where is the error code when i use KEY_ defined in keys.rb file.
I don't require the file in code (and when i did try this earlier in the day it still didn't help - even with using extend statement.

>rubyw mymainwin3.rbw
mymainwin3.rbw:39:in `init': uninitialized constant Fxwindow_code::KEY_Escape (NameError)
    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 mymainwin3.rbw:82:in `run'
    from mymainwin3.rbw:82
>Exit code: 1

and here is the actual code snippet - I was using the numbers (currently commented out to the left and it worked)

      case event.code
        when KEY_Escape #65307  #Escape key pressed
           change_radio_status 3
        when KEY_F9 #65478 # F9 pressed
           change_radio_status 4
        when KEY_F5 #65474 #F5 pressed
           change_radio_status 2
        when KEY_F1 #65470 #F1 pressed
           change_radio_status 1



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20091025/e34691b8/attachment-0001.html>

More information about the fxruby-users mailing list