[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: ruby/dl or win32API win32 help?
From:       Emmanuel Touzery <emmanuel.touzery () wanadoo ! fr>
Date:       2004-01-20 6:52:25
Message-ID: 400CD0BA.4010203 () wanadoo ! fr
[Download RAW message or body]

Hello,

    If someone is interested, I actually succeeded in making a "always 
on top" windows in ruby. In the end, i used win32api, and it worked fine :O)
    thanks to Hal Fulton for his short doc in "the ruby way" :O)

    attached, FWIW.

emmanuel

["top2.rb" (text/plain)]

#! /usr/bin/env ruby

require "fox"
include Fox

HWND_TOPMOST = -1
HWND_NOTOPMOST = -2
SWP_NOSIZE = 1
SWP_NOMOVE = 2
SWP_SHOWWINDOW = 64

require 'Win32API'

# # inspired by http://www.ruby-talk.org/cgi-bin/vframe.rb/ruby/ruby-talk/82992?82958-83286+split-mode-vertical


class FXTestMainWindow < FXMainWindow
  
  def initialize(app)
    super(app, "Test", nil, nil, DECOR_ALL, 0, 0, 350, 280 )
    @text = FXText.new(self, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP)
  end

  def setOnTop()
	setWindowPos = Win32API.new('user32', 'SetWindowPos', ["P", "P",
	"I", "I", "I", "I", "I"], "I")
	setWindowPos.call(xid, HWND_TOPMOST, 0, 0, 0, 0,
			  SWP_NOSIZE|SWP_NOMOVE)
  end

end

# Stand alone run
if __FILE__ == $0
  application = FXApp.new("Test", "ruby")
  application.init(ARGV)
  window = FXTestMainWindow.new(application)

  application.create

  window.show(PLACEMENT_SCREEN)
  window.setOnTop()
  application.run
end



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic