Dimas Cyriaco | 2 Jul 18:40

MouseEvent#dragging

I'm trying to use the dragging method of the MouseEvent, but with no
success.
Here is the code:

require 'rubygems'
require 'wx'
include Wx

class MyApp < App
  def on_init
    @frame = Frame.new(nil,-1, "Wx", DEFAULT_POSITION,
Size.new(200,200))

    evt_left_down() { | event | drag(event)}

    @frame.show
  end

  def drag(event)
    puts event.dragging
  end
end

app = MyApp.new.main_loop

I always return false, even when i'm draging the mouse.
I don't know what is wrong.

Any help?
Thanks
(Continue reading)

hendra kusuma | 1 Jul 05:07

how to read keypress in grid

Hi there

I have a form with a grid displaying all data below it
I want to be able to navigate around the grid (grid is readonly),
then when I press enter
data of current row will be put on the form

how to do that?

thank you

--
Suka linux?
Kunjungi blog saya http://penguinroad.blogspot.com

_______________________________________________
wxruby-users mailing list
wxruby-users <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/wxruby-users
Marvin Gülker | 30 Jun 23:26

Transparent widgets?

Hi,

I'm trying to create a transparent window with a StaticText on it, but I
didn't found out how this is possible. My Code looks like this:
<code>
#Encoding: UTF-8
require "wx"
require "wx_sugar"
include Wx
class TransparentFrame < Frame

  def initialize
    super(nil, -1, "Test", DEFAULT_POSITION, Size.new(400, 400),
DEFAULT_FRAME_STYLE | TRANSPARENT_WINDOW) #defining transparency style
    set_background_colour(Colour.new(0, 0, 0, 0)) #Setting transparent
back
  end

  #Overriding has_transparent_background
  def has_transparent_background
    true
  end
end

class Sample < App

  def on_init
    @mainwindow = TransparentFrame.new #Creating transparent Frame
    @text = StaticText.new(@mainwindow, -1, "Test")
    @text.set_foreground_colour(Colour.from_hex("#FFFFFF"))
    @text.set_font(Font.new(60, FONTFAMILY_ROMAN, FONTSTYLE_NORMAL,
FONTWEIGHT_BOLD))
    @text.centre_on_parent

    @mainwindow.show
  end

end

x = Sample.new
x.main_loop
</code>
That only displays a white text on a black background - no transparency.
I'm working with
Windows Vista Home Premium
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mingw32]

Marvin
--

-- 
Posted via http://www.ruby-forum.com/.
hendra kusuma | 29 Jun 09:23

catch enter key pressed in textbox

Dear all,

how can I catch enter key pressed event in a textbox?

Regards
Hendra

--
Suka linux?
Kunjungi blog saya http://penguinroad.blogspot.com

_______________________________________________
wxruby-users mailing list
wxruby-users <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/wxruby-users
Michael Satterwhite | 28 Jun 19:40

LoadError: No such file to load -- wx

I have a program written with wxruby. If I try to execute it with

   timeclock.rb

I get the error "`gem_original_require': no such file to load -- wx
(LoadError)"

If I run it with

   ruby timeclock.rb

it runs correctly. I *AM* aware of the need to load rubygems. Therefore
in my program, I have the explicit statements:

   require 'rubygems'
   require 'wx'

As a result, I'm not sure what could be the problem. Can anyone offer
any help?

Thanks in advance
---Michael
--

-- 
Posted via http://www.ruby-forum.com/.
Marvin Gülker | 26 Jun 13:33

Visual styles in Windows Vista?

Hi,

I've been using wxRuby with Visual Styles on Windows XP very well (as
described here:
http://rubyonwindows.blogspot.com/2007/10/windows-xp-visual-style-controls-with.html,
I only altered version="1.8.6.0" to version="1.9.1.0"), but this seems
not to work under Windows Vista, I only get the boring old styles. Is
there a solution for that?

Windows Vista Home Premium
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mingw32]

Marvin
--

-- 
Posted via http://www.ruby-forum.com/.
Arno Dirlam | 25 Jun 00:30

Printing plain text directly without dialogues

Hi,

I recently searched for ways printing plain (but formatted) text directly and without major requirements using ruby and stumbled upon wxruby, which seems to be a nice framework that would meet my requirements quite well.

However, since I use a local Ruby on Rails server, I would like to be able to select a printer as well as print the text without using dialogues, i.e. only using the wxruby classes to interact with the user via http responses.

I had a look at the "printing.rb" example in the wxruby directory and modified it to just print formatted text, as I want it, but it's still having dialogues. My try without dialogues was the following non-functional code:

begin
  require 'rubygems'
rescue LoadError
end
require 'wx'

dc = Wx::PrinterDC.new("", "", "") // deprecated way to initiate PrinterDC on default printer

dc.set_background(Wx::WHITE_BRUSH)
dc.clear()
dc.set_font(Wx::Font.new(12, Wx::DEFAULT, Wx::NORMAL, Wx::NORMAL, false, "Control"))

dc.set_background_mode(Wx::TRANSPARENT)

dc.draw_text( "D", 0, 0)


Since I could not figure out the whole concept of class relations in wxruby, yet, I would be very glad if someone could help me and give examples for selecting a printer and printing in wxruby without the use of dialogues.

As far as I understand, I need to create a PrintData object. This PrintData object could be handed to the device context PrinterDC containing my formatted text that got into there using draw_text methods. I don't yet understand where this PrintData comes from, if not from a dialogue (using Wx::get_app.print_data).


Thanks a lot for any hints!

Don Darone

_______________________________________________
wxruby-users mailing list
wxruby-users <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/wxruby-users
hendra kusuma | 24 Jun 10:12

how to use evt_text_enter?

evt_text_enter(id) { | event | ... }

I read above line in wxruby doc, if I'm not mistaken
it catch enter key pressed while editing a textbox
I tried to use it but it doesnot work

my code looks like this

evt_text_enter( <at> textbox.get_id) {|e| do_something(e)}

def do_something(e)
  puts <at> textbox.get_value
end

how is the right way to use that event?

--
Suka linux?
Kunjungi blog saya http://penguinroad.blogspot.com
_______________________________________________
wxruby-users mailing list
wxruby-users <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/wxruby-users
Luciano Zanotto | 23 Jun 18:29
Favicon

TextValidator problem

I'm really sorry, but sometimes I feel just I'm a little bit dumb... and 
this is the case. I'm stiil using the TextValidator class. If I use the 
standard filtering options much of the characters normally used are 
filtered out. The Wx::FILTER_ALPHANUMERIC option filters out anything 
which is not [a-z], [A-Z] or [0-9]. It would be nice to use dots, bars 
and underscores too, so I thought to call the set_includes method, but 
with no result. Can anyone tell me which kind of parameter should I pass 
to set_includes? Can anyone give me few lines of working code?
Thanks in advance to anyone
Luciano
hendra kusuma | 20 Jun 05:56

Ask : Single window & catch OnClose event

Dear all
I have 2 question here

I'm creating desktop application using wxruby and encounter some problem
I need my application to be able to open only one for each frame
is there any way to do this?
I tried to include singleton but then my frame lost its contact with its parent
(my frame class is inherited from WxFrame and I use initialize method to assign parent)

also, I need to catch OnClose event
how can I do that? I need to do something (delete temporary file) before the frame closed
code example will be appreciated :)

Thank you
--
Suka linux?
Kunjungi blog saya http://penguinroad.blogspot.com

_______________________________________________
wxruby-users mailing list
wxruby-users <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/wxruby-users
Brad Montgomery | 15 Jun 19:29

key press event

Hello all
I am new to fxruby and coming from php-gtk and rubygnome

I can not seem to capture key press events with this code
the code was modified from an online example

ruby 1.8.7, ubuntu 9.04, wxruby2.0.0

nothing is echoed to the command line
i also tried exit in the block and nothing

thanks in advance

include Wx
class MyFrame < Frame
  def initialize
    super(nil, -1, "Test Key Press Event")
    evt_key_down { |ev| puts 'a key was pressed' }
  end

end

class MinimalApp < App
  def on_init
    MyFrame.new.show
  end
end
MinimalApp.new.main_loop

happy coding
   brad
--

-- 
Posted via http://www.ruby-forum.com/.

Gmane