fxruby-users Mailing List for FXRuby (Page 14)
Status: Inactive
Brought to you by:
lyle
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(75) |
Jul
(90) |
Aug
(61) |
Sep
(56) |
Oct
(56) |
Nov
(39) |
Dec
(83) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(56) |
Feb
(45) |
Mar
(61) |
Apr
(40) |
May
(95) |
Jun
(79) |
Jul
(63) |
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
|
From: David L H. <Dav...@co...> - 2004-03-08 04:30:09
|
Hi, I'm new to Ruby, Fox and this list. Am enjoying both Ruby and FXRuby, although I'm having trouble figuring out how to do things. My application is sort of like an RS-232 terminal (similar to Procomm). I'm using the SerialPort module, which more or less works. It fails with addInput() - the callback is called immediatly which causes a few problems to say the least. Using addTimeout is a work around for now. My big problem now is that I can't seem to get makePositionVisible() to work in both in FXList and FXTreeList. I've tried the index and item version in FXList, item in FXTreeList. In both cases, the list scrolls to the first element in the list. I can use FXText to display my data, and there makePositionVisible() works. However, I'd rather have lines as items... I'm trying to log events in the lists, and would like the list to scroll up to display the most recent. my append code looks like this: if USE_TREE item= @cmdOutput.addItemLast(nil, text) @cmdOutput.makeItemVisible(item) # list scrolls to first item elsif USE_TXT_LIST ix= @cmdOutput.appendItem(item= FXListItem.new(text)) @cmdOutput.makeItemVisible(item) # list scrolls to first item OR @cmdOutput.makeItemVisible(ix) # list scrolls to first item else @cmdOutput.appendText(text) @cmdOutput.makePositionVisible(@cmdOutput.text.length) # srolls to put last line at bottom where I want end Any ideas? |
From: Lyle J. <ly...@kn...> - 2004-03-07 23:46:33
|
On Mar 7, 2004, at 12:36 PM, John Reed wrote: > I don=92t know how to capture the SEL_CLOSE event in my program = because=20 > if the dialog box used in the program for data entry is open, and=20 > there have been changes, I want to warn the user about those changes.=20= > I tried attaching the .connect(SEL_CLOSE) to the contents object, but=20= > that didn=92t work. No, there's no point in connecting SEL_CLOSE on the "contents" object=20 since it's a vertical frame and not an FXMainWindow. I *started* to say=20= that this shouldn't be a big deal, because if you display the dialog=20 box modally, the user wouldn't be able to click the main window's close=20= button. But I just ran a quick test and it doesn't appear that modality=20= of a dialog box prevents you from closing the application's main window=20= (this was a surprise to me). So another option to consider is to save a reference to the dialog box=20= when you construct it, e.g. @theDataEntryDialog =3D FXDialogBox.new(...) and then check to see if it's still shown in your SEL_CLOSE handler for=20= the main window: theMainWindow.connect(SEL_CLOSE) { ... if @theDataEntryDialog.shown? then don't close yet = ... } Why don't you see if that does the trick? If not, we'll take another=20 look. Hope this helps, Lyle |
From: Jamey C. <jc...@tw...> - 2004-03-06 15:25:02
|
Lyle Johnson wrote: > If you have additional questions after checking out the attached > example, please let me know. And I'll try to add some docs for this > the next time around ;) > > Hope this helps, Thank you, it helped very much! I very much appreciate the working example you attached. It made the whole thing very clear. Thanks again and good luck in you new job! Jamey Cribbs |
From: Lyle J. <ly...@kn...> - 2004-03-06 14:22:52
|
On Mar 4, 2004, at 5:07 AM, Hal Fulton wrote: > I'm having trouble dynamically displaying child windows in a parent > window. Hal, I haven't tried to run the code but I think I see the problem. Remember that whenever you construct new windows (or icons, whatever) after the main event loop has started that you also need to call create() on those objects to realize them (i.e. bind the Ruby objects to actual onscreen windows). I think you probably want to modify your show_notes method to look something like this: def show_notes(notes,window) off = 30 # Magic number! bad coding style notes.each_with_index do |note,i| box = FXMDIChild.new(window,note,nil,nil,MDI_NORMAL,0,off*i,0,0) FXText.new(box) box.create # Lyle added this! box.show box.position(10,off*i+6,100,40) end window.recalc end Hope this helps, Lyle |
From: Lyle J. <ly...@kn...> - 2004-03-06 14:15:14
|
On Mar 4, 2004, at 11:50 PM, Daniel Sheppard wrote: > I've been playing around with the scrollwindow widget, and it's causing > me much confusion. Whatever I try to put into the scrollwindow seems to > get resized to fit within the scroll window, regardless of what layout > hints I give it. I need to add a note on the FOX Community Wiki about this, since it comes up a lot. The problem is that some kinds of content windows (including the FXCanvas) don't correctly report their default size to the scroll window and as a result it doesn't "know" how big they really are. A workaround for this with the FXCanvas is to simply place the canvas inside some other container (like an FXHorizontalFrame), and make that container the child of the scroll window, e.g. scroll = FXScrollWindow.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y) canvasFrame = FXHorizontalFrame.new(scroll, LAYOUT_FILL_X|LAYOUT_FILL_Y) canvas = FXCanvas.new(canvasFrame, nil, 0, LAYOUT_EXPLICIT, 0, 0, 600, 600) I think this change will get you the desired effect. Hope this helps, Lyle |
From: Lyle J. <ly...@kn...> - 2004-03-06 13:58:50
|
On Mar 4, 2004, at 2:31 PM, Tom wrote: > I'm using a table where I'm initializing it to 4x4, and then resizing > the columns to be either wider or narrower, depending on content. The > problem is that I can't seem to get rid of that empty white area to > the left and bottom of the table when the contents of the table shrink > in size. I am having trouble visualizing the problem. Could you post (or send me privately) an example program that demonstrates the problem? |
From: Lyle J. <ly...@kn...> - 2004-03-06 02:39:31
|
On Feb 26, 2004, at 8:56 AM, Jamey Cribbs wrote: > Is there a way to sort the IconList by anything other than the first > column? Why do I always click "Send" before attaching the attachments? Oh, well, here it is... |
From: Lyle J. <ly...@kn...> - 2004-03-06 02:38:20
|
On Feb 26, 2004, at 8:56 AM, Jamey Cribbs wrote: > Sorry if this question has been answered. I googled but did not find > anything... > > I'm trying to sort an IconList by the column that is clicked when the > user clicks a column header. OK. > If I use the sortItems method, it just sorts by the first column. Yes, this is indeed the default sorting method. To sort the items differently, you need to override the icon item's <=> method, as you would generally do for sortable Ruby objects. Of course, since this isn't documented, you would have a hard time knowing that ;) Please see the attached program for a contrived, but hopefully illustrative, example. ;) > I tried using sort_by: > > @iconlist.sort_by {|item| item.getText.split("\t")[@clickedColumn]} Remember that Enumerable#sort_by doesn't do an in-place sort, but rather returns a new array of the sorted items, e.g. # After this, anArray is still unsorted! sortedArray = anArray.sort_by { ... } > Is there a way to sort the IconList by anything other than the first > column? If you have additional questions after checking out the attached example, please let me know. And I'll try to add some docs for this the next time around ;) Hope this helps, Lyle |
From: Daniel S. <da...@pr...> - 2004-03-05 05:58:49
|
I've been playing around with the scrollwindow widget, and it's causing me much confusion. Whatever I try to put into the scrollwindow seems to get resized to fit within the scroll window, regardless of what layout hints I give it. How do you put something bigger than a scrollwindow into the scrollwindow without shrinkage? Below is a demonstration of my problem: ---- require 'fox' include Fox class MyWindow < FXMainWindow =20def initialize (theApp) =20 super(theApp, "test", nil, nil, DECOR_ALL, 0, 0, 300, 300) =20 scroll =3D FXScrollWindow.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y) =20 canvas =3D FXCanvas.new(scroll, nil, 0, LAYOUT_EXPLICIT, 0, 0, 600, 6= 00) =20 canvas.connect(SEL_PAINT) { =20 FXDCWindow.new(canvas) { |dc| =20 dc.foreground=3D"red" =20 dc.fillRectangle(0,0,canvas.width, canvas.height) =20 } =20 } =20end =20def create =20 super =20 show(PLACEMENT_SCREEN) =20end end FXApp.new("test", "test") do |theApp| =20 MyWindow.new(theApp) =20 theApp.create =20 theApp.run end #########################################################################= ############ This email has been scanned by MailMarshal, an email content filter. #########################################################################= ############ |
From: Tom <tku...@so...> - 2004-03-04 20:38:09
|
Hi all, I'm using a table where I'm initializing it to 4x4, and then resizing the columns to be either wider or narrower, depending on content. The problem is that I can't seem to get rid of that empty white area to the left and bottom of the table when the contents of the table shrink in size. What I have is something like this: table = FXTable.new(parent,4,4,nil,nil, TABLE_COL_SIZABLE|TABLE_NO_COLSELECT|JUSTIFY_LEFT|LAYOUT_CENTER_Y, 0,0,0,0,5,5,5,5) table.setTableSize(4,4) ... iterate through the stuff that populates the table with table.setItemText(...) table.setColumnWidth(...) # several of these, fitting to the given data I have even added to the very end of the table-populating function: table.resize(table.getDefaultWidth(),table.getDefaultHeight()) and I still have empty white area off to the unused region. It seems that the unused region only obeys the 4x4 specification it was started with and will not flex to some other dimensions. Any ideas? Thanks, Tom |
From: Hal F. <ha...@hy...> - 2004-03-04 11:17:34
|
I left some "junk" in the code I just posted: FXButton.new(pim.main.right,"Blah") pim.main.right.show The above two lines are irrelevant and should be ignored (and they do NOT work). Hal |
From: Hal F. <ha...@hy...> - 2004-03-04 11:13:50
|
I'm having trouble dynamically displaying child windows in a parent window. The (ugly pre-alpha) code is shown at the bottom of this email -- see the last 20 lines, where comments say "this works" and "this doesn't." The code depends on a tree of subdirs existing under exper/data. If you want to build some random data for that, here's some code (tweaking it will make it smaller than the approx. 6000 nodes and 4 meg I have). Thanks for any assistance... Hal ################################################# # Build some fake data root = "exper/data" NumRange = [0, 5, 10, 15, 60, 70, 80, 100, 200, 300] DirRange = [0, 1, 1, 1, 2, 2, 3 ] TopRange = [5, 5, 10, 10, 20, 20, 100] LeafProb = 0.25 LenRange = [20]*8 + [100]*6 + [300]*4 + [800]*2 + [1600]*1 Alpha = ("a".."z").to_a + ["\n"] def add_files many = NumRange[rand(NumRange.length)] name = "file001" 1.upto(many) do |i| size = LenRange[rand(LenRange.length)] file = File.open(name,"w") 1.upto(size) do |char| file.print(Alpha[rand(26)]) end file.close name.succ! end end def add_dirs(depth) name = "dir001" range = DirRange many = range[rand(range.length)] dirs = [] 1.upto(many) do |i| dirs << name.dup name.succ! end dirs end def filldir(depth,name) Dir.mkdir(name) Dir.chdir(name) do add_files return if depth > 1 dirs = add_dirs(depth) dirs.each {|dir| filldir(depth+1,dir) } end end topdirs = ("aa".."ap").to_a Dir.chdir(root) topdirs.each do |td| filldir(0,td) end ############################################################ # The app itself require "fox" require "yaml" include Fox module Fox class FXTreeList alias :expand :expandTree alias :add :addItemLast end end FillXY = LAYOUT_FILL_X|LAYOUT_FILL_Y Sunken_FillXY = FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y CenterXY_FixHW = LAYOUT_CENTER_X|LAYOUT_CENTER_Y| LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT CMD_ENABLE = MKUINT(FXWindow::ID_ENABLE, SEL_COMMAND) CMD_DISABLE = MKUINT(FXWindow::ID_DISABLE, SEL_COMMAND) CMD_QUIT = MKUINT(FXApp::ID_QUIT, SEL_COMMAND) class Tree attr_accessor :topic, :leaf, :subtrees, :notes, :dir, :title @@nodes = 0 @@leaves = 0 def initialize(topic) @topic = topic @subtrees = [] @leaf = true # ?? @notes = [] @dir = topic.dir @title = topic.title end def add_child(item,note=nil) @@nodes += 1 if note.nil? file = "#{item.dir}/index.yaml" hash = File.open(file) {|f| ::YAML.load(f) } rescue {'title' => item.dir} item.title = hash['title'] @subtrees << Tree.load(item) @leaf = false else @notes << note @leaf = true @@leaves += 1 end end def Tree.load(topic) tree = Tree.new(topic) # will return this object Dir.chdir(topic.dir) do entries = Dir.entries(".") - %w[. ..] entries.each do |x| if File.directory?(x) tree.add_child(Topic.new(x)) else tree.add_child(x,File.read(x)) end end end tree end def each(&b) #if b b.call self @subtrees.each {|sub| sub.each(&b) } #end end def out puts self self.subtrees do |sub| sub.out {|x| puts x } end end def printdata end def to_a temp = [self] self.subtrees.each do |sub| temp << sub.to_a end temp end def leaf? @leaf end def nodes @@nodes end def leaves @@leaves end def inspect self.topic.dir end def to_s inspect end def to_str inspect end end class Topic attr_accessor :dir, :title def initialize(dir) @dir = dir @title = nil # ? # @index = File.open("#{dir}/Index.yaml") {|f| ::YAML.load(f) } rescue [] end def to_str @dir end def inspect "#@dir:#@title" end end class MyMain < FXMainWindow attr_reader :right, :tree def mktree(treetop,list) ntop = nil first = list.shift node = @tree.add(treetop,first.to_str) node.data = first list.each do |item| mktree(node, item) end end def initialize(app) # Initialize base class super(app,"Tycho",nil,nil,DECOR_ALL) # Main window layout menubar = FXMenubar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X) @buttons = FXHorizontalFrame.new(self) @rest = FXHorizontalFrame.new(self,FillXY) @split = FXSplitter.new(@rest, Sunken_FillXY) @left = FXVerticalFrame.new(@split,Sunken_FillXY, 0,0,0,0, 0,0,0,0) # @right = FXVerticalFrame.new(@split,Sunken_FillXY) @right = FXMDIClient.new(@split) @right.height = 400 @right.width = 600 # Make MDI Menu @mdimenu = FXMDIMenu.new(self, @right) # MDI buttons in menu:- note the message ID's!!!!! # Normally, MDI commands are simply sensitized or desensitized; # Under the menubar, however, they're hidden if the MDI Client is # not maximized. To do this, they must have different ID's. FXMDIWindowButton.new(menubar, @right, FXMDIClient::ID_MDI_MENUWINDOW, LAYOUT_LEFT) FXMDIDeleteButton.new(menubar, @right, FXMDIClient::ID_MDI_MENUCLOSE, FRAME_RAISED|LAYOUT_RIGHT) FXMDIRestoreButton.new(menubar, @right, FXMDIClient::ID_MDI_MENURESTORE, FRAME_RAISED|LAYOUT_RIGHT) FXMDIMinimizeButton.new(menubar, @right, FXMDIClient::ID_MDI_MENUMINIMIZE, FRAME_RAISED|LAYOUT_RIGHT) self.connect(SEL_UPDATE) { unless @right.activeChild.nil? self.title = @right.activeChild.title else self.title = "Tycho" end } @tree = FXTreeList.new(@left, 0, nil, 0, (FRAME_SUNKEN|FRAME_THICK| LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_RIGHT|TREELIST_SHOWS_LINES| TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT)) treetop = @tree.add(nil, "Tycho datastore") @tree.expand(treetop) @tree.disableItem(treetop) cant_select = [treetop] root = Topic.new("exper/data") datatree = Tree.load(root) data = datatree.subtrees.to_a data.each do |item| mktree(treetop, item.to_a) end @btnQuit = FXButton.new(@buttons,"Quit") @btnQuit.connect(SEL_COMMAND) do getApp().handle(@btnQuit, CMD_QUIT, nil) end @btnQuit.connect(SEL_KEYPRESS) do |sender, sel, event| if event.code == KEY_Return || event.code == KEY_KP_Enter getApp().handle(@btnQuit, CMD_QUIT, nil) end end @btnQuit.setLayoutHints(LAYOUT_CENTER_X) end def create super # Do base-class create first # Resize the left pane so that it's wide enough @left.width = 1.1*@tree.contentWidth self.height = 480 self.width = 680 # Now show the main window show(PLACEMENT_SCREEN) end end class Tycho attr_reader :main, :app def initialize super # Now init Fox... @app = FXApp.new("Tycho","myself") @app.init(ARGV) @main = MyMain.new(@app) # @app.create # @app.run end end pim = Tycho.new def show_notes(notes,window) off = 30 # Magic number! bad coding style notes.each_with_index do |note,i| box = FXMDIChild.new(window,note,nil,nil,MDI_NORMAL,0,off*i,0,0) FXText.new(box) box.show box.position(10,off*i+6,100,40) end window.recalc end strs = ["This is a note", "This is another note", "These notes are little pieces of information", "Such as code snippets, phone numbers,", "addresses, quotations, URLs, and...", "other such random stuff.", "Unlike this corny example, they will usually", "not be related directly to each other.", "This PIM is ultimately supposed to be a full-featured program", "reminiscent of Info Select (www.miclog.com)."] ## This piece of code works # show_notes(strs,pim.main.right) FXButton.new(pim.main.right,"Blah") pim.main.right.show ## This one doesn't pim.main.tree.connect(SEL_COMMAND) do |sender,sel,ptr| show_notes(ptr.data.notes,pim.main.right) pim.main.right.recalc end pim.app.create pim.app.run |
From: Matthew M. <nam...@na...> - 2004-03-03 22:28:27
|
Hi Lyle, On Tue, Mar 02, 2004 at 09:54:43PM -0600, Lyle Johnson wrote: > > As often as this question gets asked (both here and on the foxgui-users > mailing list) I figured someone would have posted some code to the FOX > community Wiki site for this by now. But they had not. So I just did ;) > > Here is a recipe for how to get this done in FXRuby: > > http://www.fifthplanet.net/cgi-bin/wiki.pl?Cookbook/ > Right_Mouse_Context_Menu > > Hope this helps, and please follow up if there are some details that > could be added to the online explanation. Thank you for this! It seems that what I was missing was getApp().runModalWhileShown, while I've not yet tried it I have faith that I can make it work now. ;) One again Lyle thank you for your help. The Ruby community is just great! Take care, Matthew. -- ...but once you get locked into a serious drug collection, the tendency is to take it as far as it'll go." -- Hunter S. Thompson |
From: Lyle J. <ly...@kn...> - 2004-03-03 04:20:45
|
On Mar 2, 2004, at 6:15 PM, Matthew Miller wrote: > I'm still learning and have a new question ;) I want my file manager > application > to display a menu when an item in a FXList is right-clicked. The menu > displays > fine, but once it is displayed my window manager freezes up and I have > to go > to a console and kill my application, after which my X session is back > to normal. <snip> > Well, any insight or pointers to an example would be very helpful. As often as this question gets asked (both here and on the foxgui-users mailing list) I figured someone would have posted some code to the FOX community Wiki site for this by now. But they had not. So I just did ;) Here is a recipe for how to get this done in FXRuby: http://www.fifthplanet.net/cgi-bin/wiki.pl?Cookbook/ Right_Mouse_Context_Menu Hope this helps, and please follow up if there are some details that could be added to the online explanation. Lyle |
From: Hal F. <ha...@hy...> - 2004-03-03 02:49:32
|
OK, I have some code here that is really not ready for public viewing yet. But I'm attaching it just for tech support. (I feel a little like a television crew is filming my messed-up living room.) Basically I want to click on a tree item and fill the right-hand window with a bunch of subwindows related to that tree item. Near the bottom of the file, there are two code fragments, both commented out. The one that indiscriminately sticks dummy child windows on the right works. The one attached to the tree selection doesn't. The "exper/data" directory merely contains an arbitrary directory structure, with any directories possibly containing text files. Any assistance appreciated. Cheers, Hal Fulton |
From: Matthew M. <nam...@na...> - 2004-03-03 00:21:00
|
Hi everyone, I'm still learning and have a new question ;) I want my file manager application to display a menu when an item in a FXList is right-clicked. The menu displays fine, but once it is displayed my window manager freezes up and I have to go to a console and kill my application, after which my X session is back to normal. Here are the relevant parts from the initialize method in my FXWindow subclass. I can post the whole thing if necessary. @rightClickMenu = FXMenuPane.new( self ) FXMenuCommand.new( @rightClickMenu, "Cut\tCtl-X" ). connect( SEL_COMMAND, method(:cmdCut)) FXMenuCommand.new( @rightClickMenu, "Copy\tCtl-C" ). connect( SEL_COMMAND, method(:cmdCopy)) FXMenuCommand.new( @rightClickMenu, "Paste\tCtl-V" ). connect( SEL_COMMAND, method(:cmdPaste)) FXMenuCommand.new( @rightClickMenu, "Rename\tF2" ). connect( SEL_COMMAND, method(:cmdRename)) @list.connect( SEL_RIGHTBUTTONPRESS, method(:cmdRightButtonPress)) Other class methods: def cmdRightButtonPress( sender, sel, event ) if @rightClickMenu.shown # @rightClickMenu.hide @rightClickMenu.popdown end @rightClickMenu.popup( getParent(), event.win_x + self.getX, event.win_y + self.getY ) end def onSelect( sender, sel, event ) @selectedIndex = event if @ctrlPressed @selectedItems << @selectedIndex else @selectedItems.clear end if @rightClickMenu.shown @rightClickMenu.popdown end end Currently the methods given to FXMenuCommand only call @rightClickMenu.popdown and exit. I've looked at the C++ source for FXMenuTitle and it was some help; I learned of the popup and popdown methods. The statements that are shown in that file for using grap and ungrap methods doesn't work, undefined method errors are returned. Well, any insight or pointers to an example would be very helpful. Take care, Matthew. -- "[In] my era everybody smoked and everybody drank and there was no drug use" -- DEA Chief Thomas Constantine, July 1, 1998 |
From: Jamey C. <jc...@tw...> - 2004-03-02 01:21:44
|
I'm bumping this message in the hopes that someone who can shed some light on it maybe missed it the first time around. Thanks. Jamey Jamey Cribbs wrote: > Sorry if this question has been answered. I googled but did not find > anything... > > I'm trying to sort an IconList by the column that is clicked when the > user clicks a column header. > > If I use the sortItems method, it just sorts by the first column. > > I tried using sort_by: > > @iconlist.sort_by {|item| item.getText.split("\t")[@clickedColumn]} > > But that didn't do anything. > > Is there a way to sort the IconList by anything other than the first > column? > > Thanks. > > Jamey Cribbs > > > > Confidentiality Notice: This email message, including any attachments, > is for the sole use of the intended recipient(s) and may contain > confidential and/or privileged information. If you are not the > intended recipient(s), you are hereby notified that any dissemination, > unauthorized review, use, disclosure or distribution of this email and > any materials contained in any attachments is prohibited. If you > receive this message in error, or are not the intended recipient(s), > please immediately notify the sender by email and destroy all copies > of the original message, including attachments. > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users > |
From: Paul R. <pau...@sh...> - 2004-02-28 01:24:44
|
That's great - exactly what I needed. Thanks for the link. Paul -----Original Message----- From: fxr...@li... [mailto:fxr...@li...] On Behalf Of Sander Jansen Sent: 26 February 2004 21:10 To: fxr...@li... Subject: Re: [Fxruby-users] sel_command You may find this page usefull: http://www.fifthplanet.net/cgi-bin/wiki.pl?FOX_Reference/FXTextField Basically what you are looking for is this option: TEXTFIELD_ENTER_ONLY Also look at the overview of the messages FXTextfield sends.. Hope this helps, Sander On Thursday 26 February 2004 11:37 am, Paul Rogers wrote: > First let me thank Lyle for writing FXRuby. Its a really useful > toolkit. > > Now onto the problem: > Im using a sel_command and a sel_changed on a text field > > Sometimes I find that the sel_command gets fired when I click on a > different widget. I was only expecting it to get fired on pressing > return. As Im connecting to both events do I need to do anything > special? Do I need to some how trap that the enter key was pressed? > > Thanks > > Paul > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and > deploy apps & Web services for Linux with a free DVD software kit from > IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users -- "Nervous hands grip tight the knife In the darkness, till the cake is cut" - Peter Gabriel ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Fxruby-users mailing list Fxr...@li... https://lists.sourceforge.net/lists/listinfo/fxruby-users |
From: Lyle J. <ly...@kn...> - 2004-02-27 18:26:03
|
On Feb 27, 2004, at 11:48 AM, Kevin Burge wrote: > I'm looking at the dialogs example, and it looks like the only > difference between a modal and non-modal dialog is that the non-modal > dialog was created in the initialization. > > I just did a test with a dialog that I know works, and it is true: a > modal dialog is made non-modal just by moving it to the initialization > method. Well, not quite. There's nothing about the dialog box itself (including when it's created) that inherently makes it modal or non-modal. It depends on how you "invoke" the dialog box (for lack of a better term). To display a dialog box non-modally, just call show() on it: aDialogBox.show To show a dialog box and then start a modal event loop for it, you can instead use the execute method: aDialogBox.execute The FXDialogBox#execute method is just a simple convenience method; if it were implemented in Ruby, it would look something like this: def execute(placement=PLACEMENT_CURSOR) create show(placement) getApp().runModalFor(self) end Hope this helps, Lyle |
From: Kevin B. <kev...@sy...> - 2004-02-27 18:02:05
|
Nevermind. I did dlg.new, and dlg.show, but not dlg.create before the show. That solved the problem. Kevin Burge wrote: > I'm looking at the dialogs example, and it looks like the only > difference between a modal and non-modal dialog is that the non-modal > dialog was created in the initialization. > > I just did a test with a dialog that I know works, and it is true: a > modal dialog is made non-modal just by moving it to the initialization > method. > > I need to create non-modal dialogs dynamically. Is there a way to do this? > -- Kevin Burge Systemware, Inc. kev...@sy... www.systemware.com |
From: Kevin B. <kev...@sy...> - 2004-02-27 17:58:30
|
I'm looking at the dialogs example, and it looks like the only difference between a modal and non-modal dialog is that the non-modal dialog was created in the initialization. I just did a test with a dialog that I know works, and it is true: a modal dialog is made non-modal just by moving it to the initialization method. I need to create non-modal dialogs dynamically. Is there a way to do this? -- Kevin Burge Systemware, Inc. kev...@sy... www.systemware.com |
From: Lyle J. <ly...@kn...> - 2004-02-27 15:42:53
|
On Feb 26, 2004, at 7:46 AM, Allen Mitchell wrote: > I want to create an icon on the fly.... > > I tried: > > icon = FXPNGIcon.new( getApp(), nil, > FXRGB(1,2,3),IMAGE_SHMI|IMAGE_SHMP, > 24, 24 ) {|png| > > png.create > > FXDCWindow.new(png) { |dc| > dc.setForeground(FXRGB(1,2,3)) > dc.fillRectangle(0, 0, 24, 24) > dc.setForeground(FXRGB(255,0,0)) > dc.fillRectangle(0, 0, 15, 15) > } > } > > This does give me an icon, but it is not transparent where I want it > to be. > Have you ever done this sort of thing? I have not tried this before, but here are a few guesses: First, the image flags probably need to include the IMAGE_ALPHA flag so that the icon object will allocate storage for red, green, blue and alpha pixel values. I think it may also be necessary to specify IMAGE_KEEP, to tell FOX to keep the client-side pixel buffer around after the call to create(). Otherwise, I'm not sure that you can change the icon's contents after the fact. After you draw into the icon, you will call render() on the icon to get it to re-render the client-side pixels to the server-side icon resource. Second, the FXRGB() module method constructs a color value with no transparency. If you want specify an alpha component, use the FXRGBA() method instead, i.e. color = FXRGBA(255, 0, 0, 128) where the last value is the alpha, from zero to 255. Hope this helps, Lyle |
From: Lyle J. <ly...@kn...> - 2004-02-27 15:31:49
|
On Feb 26, 2004, at 7:46 AM, Allen Mitchell wrote: > Another question.... > > I deceided to create a small class for button animation: <snip> > Works great, except that how do you catch the fact that the window is > destroying in order to cancel the time. In C++ I would have a > destructor, > but here I'm not sure. Generally speaking, I don't think there is a way to reliably catch the garbage collection of an object in Ruby. I've had at best mixed success using Ruby's finalizers for this kind of thing. However, in this case you may be able to override the widget's destroy() method and remove the timeout there: class FXAnimatedButton def destroy getApp().removeTimeout(...) super # call base class version of destroy() end end I have not tried this, but it seems like it should work. Hope this helps, Lyle |
From: Sander J. <sa...@kn...> - 2004-02-27 04:12:31
|
You may find this page usefull: http://www.fifthplanet.net/cgi-bin/wiki.pl?FOX_Reference/FXTextField Basically what you are looking for is this option: TEXTFIELD_ENTER_ONLY Also look at the overview of the messages FXTextfield sends.. Hope this helps, Sander On Thursday 26 February 2004 11:37 am, Paul Rogers wrote: > First let me thank Lyle for writing FXRuby. Its a really useful toolkit. > > Now onto the problem: > Im using a sel_command and a sel_changed on a text field > > Sometimes I find that the sel_command gets fired when I click on a > different widget. I was only expecting it to get fired on pressing return. > As Im connecting to both events do I need to do anything special? > Do I need to some how trap that the enter key was pressed? > > Thanks > > Paul > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users -- "Nervous hands grip tight the knife In the darkness, till the cake is cut" - Peter Gabriel |
From: Paul R. <pau...@sh...> - 2004-02-26 22:48:45
|
I changed to a FXFileSelector and this seems to work much better Thanks Paul ----- Original Message ----- From: jeroen <je...@fo...> Date: Thursday, February 26, 2004 1:43 pm Subject: Re: [Fxruby-users] FXFileDialog and threads > On Thursday 26 February 2004 02:16 pm, Paul Rogers wrote: > > Thanks for the quick repy - I should have added im using windows. > > > > Ive also found that in a new thread the dialog doesnt always > appear. Could > > well be something else in there causing this problem though. > > Please note that only one thread, the one that created all the > windows,is the one that is allowed to play with the widget tree. > All other threads > must be humble worker-bees... > > - Jeroen > > -- > +------------------------------------------------------------------ > ----------+ > | Copyright (C) 23:50 12/11/2003 Jeroen van der Zijp. All Rights > Reserved. | > +------------------------------------------------------------------ > ----------+ > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users > |