fxruby-users Mailing List for FXRuby (Page 13)
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: Lyle J. <ly...@kn...> - 2004-03-15 14:08:45
|
On Mar 14, 2004, at 1:55 AM, Matthew Miller wrote: > FXList doesn't support [in-place editing]. Now I'm wondering how to > write a widget to > do what I want. I've looked at the C++ source for FXList and hope that > there is > an easy way to accomplish the behavior I see in sfm. After doing some > reading I > thought that I might could use a FXVerticalFrame to stack the widgets > that show > the filenames. The trouble is that I couldn't find a way to iterate > through the > contents of the frame and if necessary replace a FXLabel with a > FXTextField > object. Well, there is the FXWindow#children method in the > FXVerticalFrame > subclass, but would replacing an element in the returned array with a > different > widget affect the display? No, as you guessed, simply replacing an item in the array returned by FXWindow#children doesn't affect the window's contents. You should however be able to use either FXWindow#linkBefore or #linkAfter to reposition widgets in the vertical frame, e.g. # Replace the 5th child widget of "frame" with a text field fifthChild = parentFrame.childAtIndex(4) textField = FXTextField.new(parentFrame, ...) textField.create textField.linkAfter(fifthChild) parentFrame.removeChild(fifthChild) Note that that last call (removeChild) will actually destroy the 5th child widget completely. It's easy enough to recreate widgets on the fly, but if for some reason you want to hang on to that specific widget instance, you could instead hide it or something, i.e. fifthChild.hide # but I'm still in the list! Hope this helps, Lyle |
From: Lyle J. <ly...@kn...> - 2004-03-15 04:36:35
|
On Mar 14, 2004, at 9:45 PM, Daniel Sheppard wrote: > However, there doesn't appear to be any easy way to tell if either of > the scrollbars is displayed or not. What about just calling the scrollbar's #shown? method? |
From: Daniel S. <da...@pr...> - 2004-03-15 04:26:04
|
If you move this code: pim.main.tree.connect(SEL_COMMAND) do |sender,sel,ptr| =20 pim.main.show_notes(ptr.notes) end Up into the creation of the tree =20 @tree =3D TopicTree.new(@left,"exper/data") =20 @tree.connect(SEL_COMMAND) do |sender,sel,ptr| =20 pim.main.show_notes(ptr.notes) =20 end =20 @tree.expand And the segfault goes away. Don't ask me why. #########################################################################= ############ This email has been scanned by MailMarshal, an email content filter. #########################################################################= ############ |
From: Daniel S. <da...@pr...> - 2004-03-15 04:15:04
|
It looks to me like calling any of the connect() methods on a treelist is prone to error (my code was with SEL_DELETED and SEL_INSERTED on a treelist) I've edited your tycho.rb file by deleting a bunch of code. I've added code into two places (marked with -- daniels). It appears that the pim.main.tree.connect(SEL_COMMAND) is the root problem. Comment out that section and it exits cleanly. --------------- require "fox" require "yaml" #################################################### include Fox FillXY =3D LAYOUT_FILL_X|LAYOUT_FILL_Y Sunken_FillXY =3D FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y #################################################### class TopicTree < FXTreeList =20 Index =3D "index.yaml" =20 def addItemLast(parent,dir,path,title) =20 #item =3D TopicItem.new(dir,path,title) =20 # -- daniels =20 item =3D FXTreeItem.new(title) =20 super(parent,item) =20 item =20 end =20 def expand =20 self.expandTree(@treetop) =20 end =20 def initialize(contain,root_dir) =20 tree_opts =3D FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP| =20 LAYOUT_RIGHT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|= =20 TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT =20 super(contain, 0, nil, 0, tree_opts) =20 @treetop =3D nil =20 load(nil,root_dir) =20 end =20 def load(parent,root) =20 current =3D nil =20 Dir.chdir(root) do =20 # Load index for this dir =20 info =3D File.open(Index) {|f| ::YAML.load(f) } # error if not th= ere =20 title =3D info[0]['title'] =20 current =3D self.addItemLast(parent,root,Dir.pwd,title) =20 @treetop =3D current if @treetop.nil? =20 end =20 end end #################################################### class MyMain < FXMainWindow =20 attr_reader :right, :tree =20=20 =20 def initialize(app) =20 super(app,"Tycho (version #{Tycho::VERSION})",nil,nil,DECOR_ALL) =20 @rest =3D FXHorizontalFrame.new(self,FillXY) =20 @split =3D FXSplitter.new(@rest, Sunken_FillXY) =20 @left =3D FXVerticalFrame.new(@split,Sunken_FillXY, 0,0,0,0, 0,0,0,= 0)=20 =20 @note_widgets =3D [] =20 =20 =20 @tree =3D TopicTree.new(@left,"exper/data") =20=20 =20 end =20 def create =20 super # Do base-class create first =20 @left.width =3D 1.5*@tree.contentWidth # Make left pane wide enoug= h =20 self.height =3D 480 =20 self.width =3D 680 =20 show(PLACEMENT_SCREEN) # Show main window =20 end end #################################################### class Tycho =20 attr_reader :main, :app =20 VERSION =3D "0.0.4" =20 def initialize =20 super =20 @app =3D FXApp.new("Tycho","myself") =20 @app.init(ARGV) =20 @main =3D MyMain.new(@app) =20 end end #################################################### # "Main"... pim =3D Tycho.new pim.main.tree.connect(SEL_COMMAND) do |sender,sel,ptr| =20 # -- daniels =20 puts "This is the problem" =20 #pim.main.show_notes(ptr.notes) end pim.app.create pim.app.run #########################################################################= ############ This email has been scanned by MailMarshal, an email content filter. #########################################################################= ############ |
From: Daniel S. <da...@pr...> - 2004-03-15 03:48:19
|
I've been basing the width of one of my elements on the width of the visible content within a scrollbar. Ie. =20 aaaaaaaaaaaaab =20 sssssssssssss^ =20 sssssssssssss| =20 sssssssssssss| =20 sssssssssssss| =20 <-----------> Where aaaaa is the element that is being resized and b is the space to account for the scrollbar. However, there doesn't appear to be any easy way to tell if either of the scrollbars is displayed or not. I've cooked up the following methods: =20 def vscroll? =20 not @scroll.horizontalScrollbar.width =3D @scroll.width and =20 (@scroll.verticalScrollbar.height =3D @scroll.height or =20 (@scroll.horizontalScrollbar.width =3D @scroll.width + @scroll.verticalScrollbar.width and =20 @scroll.verticalScrollbar.height =3D @scroll.height + @scroll.horizontalScrollbar.height) =20 ) =20 end =20 def hscroll? =20 not @scroll.verticalScrollbar.height =3D @scroll.height and =20 (@scroll.horizontalScrollbar.width =3D @scroll.width or =20 (@scroll.horizontalScrollbar.width =3D @scroll.width + @scroll.verticalScrollbar.width and =20 @scroll.verticalScrollbar.height =3D @scroll.height + @scroll.horizontalScrollbar.height) =20 ) =20 end Which I know is probably missing an edge case somewhere.... I just have the feeling that there's an easier way in here somewhere that I'm just not finding. A little help anybody? #########################################################################= ############ This email has been scanned by MailMarshal, an email content filter. #########################################################################= ############ |
From: Hal F. <ha...@hy...> - 2004-03-15 03:45:55
|
Daniel Sheppard wrote: > I've experienced the same (or similar) problem - same error messages > anyway. > > I don't believe that it is related to the overriding of the objects. > > Have a look at the code at > http://sourceforge.net/tracker/index.php?func=detail&aid=913892&group_id > =20243&atid=120243 - it provides as little code as I could to reproduce > the problem. Are there any common elements with your code? > > I have a feeling the segfault is caused by a race condition involved in > the disposal code of either the treelist or the treeitem object, due to > the fact that adding profiling to the code also introduces the segfault > (see > http://sourceforge.net/tracker/index.php?func=detail&aid=913892&group_id > =20243&atid=120243) It's not obvious to me what the commonality is. What *is* interesting is that it segfaults on Linux the same as on Windows. Now that's cross-platform! ;) Hal |
From: Daniel S. <da...@pr...> - 2004-03-14 22:35:06
|
I've experienced the same (or similar) problem - same error messages anyway. I don't believe that it is related to the overriding of the objects.=20 Have a look at the code at http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D913892&group= _id =3D20243&atid=3D120243 - it provides as little code as I could to reprodu= ce the problem. Are there any common elements with your code? I have a feeling the segfault is caused by a race condition involved in the disposal code of either the treelist or the treeitem object, due to the fact that adding profiling to the code also introduces the segfault (see http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D913892&group= _id =3D20243&atid=3D120243) > -----Original Message----- > From: Hal Fulton [mailto:ha...@hy...]=20 > Sent: Sunday, 14 March 2004 10:23 PM > To: fxr...@li... > Subject: [Fxruby-users] Error:=20 > FXRbGetRubyObj(this=3D0x084e7fb8) returns non-Qnil >=20 >=20 > I've been rewriting my tree logic and it's much cleaner and=20 > shorter now. >=20 > I subclass TopicItem < FXTreeItem and TopicTree < FXTreeList=20 > -- then I override addItemLast to create a TopicItem; and=20 > then call super with that item; and then return the item. >=20 > But I'm getting an error every time I click a tree item (see=20 > subject line). The object id differs. >=20 > Partial code below. (For the whole thing, see=20 > tycho.rubyforge.org and run mkdata.rb first.) >=20 > However, it all works fine besides the error message, EXCEPT=20 > that it segfaults when I hit the Quit button. >=20 > Ideas??? >=20 > Thanks, > Hal >=20 >=20 >=20 >=20 >=20 > class TopicItem < FXTreeItem >=20 > attr_accessor :dir, :path, :title, :notes >=20 > def initialize(dir,path,title) > super(title) > @dir, @path =3D dir, path > @notes =3D [] > end >=20 > end >=20 > #################################################### >=20 > class TopicTree < FXTreeList >=20 > Index =3D "index.yaml" >=20 > def addItemLast(parent,dir,path,title) > item =3D TopicItem.new(dir,path,title) > super(parent,item) > item > end >=20 > def expand > self.expandTree(@treetop) > end >=20 > def initialize(contain,root_dir) > tree_opts =3D=20 > FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP| > =20 > LAYOUT_RIGHT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES| > TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT > super(contain, 0, nil, 0, tree_opts) > @treetop =3D nil > load(nil,root_dir) > end >=20 > def load(parent,root) > current =3D nil > Dir.chdir(root) do > # Load index for this dir > info =3D File.open(Index) {|f| ::YAML.load(f) } # error=20 > if not there > title =3D info[0]['title'] > current =3D self.addItemLast(parent,root,Dir.pwd,title) > @treetop =3D current if @treetop.nil? >=20 > # Load all files as notes > files =3D Dir.all_files - [Index] > current.notes =3D files.map {|x| Note.new(x) } >=20 > # Recurse and load directories as topics > Dir.all_dirs.each {|dir| load(current,dir) } > end > end >=20 > end >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President=20 > and CEO of GenToo technologies. Learn everything from=20 > fundamentals to system=20 > administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dc= lick > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users >=20 #########################################################################= ############ This email has been scanned by MailMarshal, an email content filter. #########################################################################= ############ |
From: Hal F. <ha...@hy...> - 2004-03-14 11:23:05
|
I've been rewriting my tree logic and it's much cleaner and shorter now. I subclass TopicItem < FXTreeItem and TopicTree < FXTreeList -- then I override addItemLast to create a TopicItem; and then call super with that item; and then return the item. But I'm getting an error every time I click a tree item (see subject line). The object id differs. Partial code below. (For the whole thing, see tycho.rubyforge.org and run mkdata.rb first.) However, it all works fine besides the error message, EXCEPT that it segfaults when I hit the Quit button. Ideas??? Thanks, Hal class TopicItem < FXTreeItem attr_accessor :dir, :path, :title, :notes def initialize(dir,path,title) super(title) @dir, @path = dir, path @notes = [] end end #################################################### class TopicTree < FXTreeList Index = "index.yaml" def addItemLast(parent,dir,path,title) item = TopicItem.new(dir,path,title) super(parent,item) item end def expand self.expandTree(@treetop) end def initialize(contain,root_dir) tree_opts = 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 super(contain, 0, nil, 0, tree_opts) @treetop = nil load(nil,root_dir) end def load(parent,root) current = nil Dir.chdir(root) do # Load index for this dir info = File.open(Index) {|f| ::YAML.load(f) } # error if not there title = info[0]['title'] current = self.addItemLast(parent,root,Dir.pwd,title) @treetop = current if @treetop.nil? # Load all files as notes files = Dir.all_files - [Index] current.notes = files.map {|x| Note.new(x) } # Recurse and load directories as topics Dir.all_dirs.each {|dir| load(current,dir) } end end end |
From: Matthew M. <nam...@na...> - 2004-03-14 07:55:39
|
Hello, On the fifthplanet wiki I saw one answer to a question I hadn't asked yet ;^) The question dealt with subclassing FXList to draw the list items in different colors. Lyle provide a very good solution in C++. I'm wondering if, using his solution as a guide, the same result could be done using FXRuby. I thought I would ask and see if there were any gotchas before I tried an implementation in Ruby. I've one more question as well. The way that I'm learning FXRuby is to write a file manager that is similar to the one called sfm that was written using GTK+. When renaming a file in sfm the equivalent of a FXLabel is replaced by a one-line text field where the filename can be edited (i.e. the same way that the Windows Explorer works.) FXList doesn't support this behavior. Now I'm wondering how to write a widget to do what I want. I've looked at the C++ source for FXList and hope that here is an easy way to accomplish the behavior I see in sfm. After doing some reading I thought that I might could use a FXVerticalFrame to stack the widgets that show the filenames. The trouble is that I couldn't find a way to iterate through the contents of the frame and if necessary replace a FXLabel with a FXTextField object. Well, there is the FXWindow#children method in the FXVerticalFrame subclass, but would replacing an element in the returned array with a different widget affect the display? Well, for both these things I'm looking for some insight. Thanks. Matthew. -- Where it is a duty to worship the sun it is pretty sure to be a crime to examine the laws of heat. -- Christopher Morley |
From: Hal F. <ha...@hy...> - 2004-03-12 22:54:19
|
Oops, meant to send this to the list, not just to Lyle. See below. H Lyle Johnson wrote: >> How do I pass the non-Esc keys back into the FXText object? > false # i.e. signal that we didn't handle this message Works beautifully, thank you. What about the other issue? Is it doable? I want to click on the MDIClient background and take the focus away from the child. Hal |
From: Lyle J. <ly...@kn...> - 2004-03-12 14:01:51
|
On Mar 12, 2004, at 4:09 AM, Hal Fulton wrote: > The escape is not working properly either. It's intercepting all > keystrokes and throwing them away. > > boxtext.connect(SEL_KEYPRESS) do |sender, sel, event| > if event.code == KEY_Escape > sender.killFocus > end > end > > How do I pass the non-Esc keys back into the FXText object? Try this instead: boxtest.connect(SEL_KEYPRESS) do |sender, sel, event| if event.code == KEY_Escape sender.killFocus else false # i.e. signal that we didn't handle this message end end Hope this helps, Lyle |
From: Hal F. <ha...@hy...> - 2004-03-12 10:20:19
|
The escape is not working properly either. It's intercepting all keystrokes and throwing them away. boxtext.connect(SEL_KEYPRESS) do |sender, sel, event| if event.code == KEY_Escape sender.killFocus end end How do I pass the non-Esc keys back into the FXText object? Hal |
From: Hal F. <ha...@hy...> - 2004-03-12 10:00:59
|
Still can't figure out how to click on the MDIClient background and kill focus on the child and its FXText. Hal |
From: Hal F. <ha...@hy...> - 2004-03-12 04:44:25
|
I have an MDIChild with an FXText inside it. I click the window and change the text. I want to kill the focus when the MDIClient background is clicked. I'd also like (I think) to kill the focus when escape is pressed. Tried to hook into the MDIClient and do a kiilFocus on the active child. Must have done something wrong. Not obvious to me how to proceed. Assistez-moi? Hal |
From: Jamey C. <jc...@tw...> - 2004-03-11 22:06:11
|
I must be crazy. After Lyle answered my question about sorting a FXIconList, I spent the next few days coding my app using the IconList. I got it all done. It looks good. It's responsive. So what do I do, I start messing around with FXTable, because, even though IconList works, I would REALLY love to have grid lines, alternating row background colors, and column justification in my listviews. So, I couldn't leave well enough alone. I'm thinking about ripping the IconLists out of my app and replacing them with Tables. I've got most of the functionality I need working for the Table, but I have (again) come upon the sorting issue. FXTable has a sort and a sort_by method. Using Lyle's IconList example as a starting point, I started messing around with the sort method. I overrode the FXTableItem's <=> method, but I ran into my first problem. Whereas the sortItems method in IconList was using the entire tab-delimited row, it was easy for me to split the row into an array and specify the column I wanted to sort on by using an index to the array. However, since the TableItem represents only one cell, it seems to be defaulting to the first column of the Table. I'm stumped as to how to get it to sort by another column. Also, although the sort method does call the TableItem's <=> method, and the <=> method does return a -1, 0, or 1 based on the current value and the argument's value, it does not appear to be actually producing a table sorted on the first row. What I mean is, even though I can see the sort method actually running and calling <=> for each cell in column 0, the table is not resorted after the method finishes. So that's my question with the sort method of FXTable. I also looked at the sort_by method. It appears that the sort_by method is looking for a code block that it will pass an entire row of cells to. For a while, I thought I had found what I needed. But I'm not sure what I'm supposed to put in this code block. Anyway, any light shed upon FXTable sorting would be greatly appreciated! 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. |
From: Daniel S. <da...@pr...> - 2004-03-11 05:04:12
|
I guess it gets a trip to the bugtracker then. Thanks. > -----Original Message----- > From: Paul Rogers [mailto:pau...@sh...]=20 > Sent: Thursday, 11 March 2004 3:32 PM > To: fxr...@li... > Subject: RE: [Fxruby-users] Cannot connect to SEL_DELETED on=20 > a treeList >=20 >=20 > Out of interest I tried this, as I had lots of seg faults a=20 > week or so ago in my code. >=20 > Im using win XP Home ruby 1.8.0 (2003-08-04) [i386-mswin32]=20 > from the windows installer( with no FX updates) >=20 > The code below worked fine (once I added the require, include=20 > etc) . No seg faults, no FXRbGetRubyObj.... >=20 >=20 > Let me know if you want me to try anything else. >=20 > Paul #########################################################################= ############ This email has been scanned by MailMarshal, an email content filter. #########################################################################= ############ |
From: Paul R. <pau...@sh...> - 2004-03-11 04:45:18
|
Out of interest I tried this, as I had lots of seg faults a week or so ago in my code. Im using win XP Home ruby 1.8.0 (2003-08-04) [i386-mswin32] from the windows installer( with no FX updates) The code below worked fine (once I added the require, include etc) . No seg faults, no FXRbGetRubyObj.... Let me know if you want me to try anything else. Paul -----Original Message----- From: fxr...@li... [mailto:fxr...@li...] On Behalf Of Daniel Sheppard Sent: 10 March 2004 19:17 To: fxr...@li... Subject: RE: [Fxruby-users] Cannot connect to SEL_DELETED on a treeList Incidentally, when I run it and click the item to remove it, I get the following in my output: FXRbGetRubyObj(this=0x07027cb0) returns non-Qnil Anybody know what that means and how to resolve it? > -----Original Message----- > From: Daniel Sheppard > Sent: Thursday, 11 March 2004 12:59 PM > To: fxr...@li... > Subject: [Fxruby-users] Cannot connect to SEL_DELETED on a treeList > > > Eeep. And now more segfaults. Either I'm missing out on some > fundamentals here, or there's much bugginess about. > > Once I connect to SEL_DELETED on a @treeList, I get a > segfault on exit if the tree isn't empty. If I run the > following program and exit immediately, I get a segfault. If > I click the item (removing it), it exits cleanly. > > --- > > class TestWindow < FXMainWindow > def initialize(parent) > super(parent, "test", nil, nil, DECOR_ALL, 0, 0, 400, 300) > @treeList = FXTreeList.new(self, 0) > @treeList.connect(SEL_DELETED) { |a,b,item| puts "deleted"} > @treeList.connect(SEL_CLICKED) { |a,b,item| > @treeList.removeItem(item, true); puts "removed"} > item = @treeList.addItemLast(nil, FXTreeItem.new("hello"), true) > end > def create > super > show(PLACEMENT_SCREEN) > end > end > > if __FILE__ == $0 > FXApp.new("test7", "test") do |theApp| > TestWindow.new(theApp) > theApp.create > theApp.run > end > end > ############################################################## > ####################### > This email has been scanned by MailMarshal, an email content > filter. > ############################################################## > ####################### > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President > and CEO of GenToo technologies. Learn everything from > fundamentals to system > administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=ick > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users > ######################################################################## ############# This email has been scanned by MailMarshal, an email content filter. ######################################################################## ############# ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=ick _______________________________________________ Fxruby-users mailing list Fxr...@li... https://lists.sourceforge.net/lists/listinfo/fxruby-users |
From: Daniel S. <da...@pr...> - 2004-03-11 02:29:51
|
Incidentally, when I run it and click the item to remove it, I get the following in my output: FXRbGetRubyObj(this=3D0x07027cb0) returns non-Qnil Anybody know what that means and how to resolve it? > -----Original Message----- > From: Daniel Sheppard=20 > Sent: Thursday, 11 March 2004 12:59 PM > To: fxr...@li... > Subject: [Fxruby-users] Cannot connect to SEL_DELETED on a treeList >=20 >=20 > Eeep. And now more segfaults. Either I'm missing out on some=20 > fundamentals here, or there's much bugginess about. >=20 > Once I connect to SEL_DELETED on a @treeList, I get a=20 > segfault on exit if the tree isn't empty. If I run the=20 > following program and exit immediately, I get a segfault. If=20 > I click the item (removing it), it exits cleanly. >=20 > --- >=20 > class TestWindow < FXMainWindow > def initialize(parent) > super(parent, "test", nil, nil, DECOR_ALL, 0, 0, 400, 300) > @treeList =3D FXTreeList.new(self, 0) > @treeList.connect(SEL_DELETED) { |a,b,item| puts "deleted"} > @treeList.connect(SEL_CLICKED) { |a,b,item|=20 > @treeList.removeItem(item, true); puts "removed"} > item =3D @treeList.addItemLast(nil, FXTreeItem.new("hello"), true) > end > def create > super > show(PLACEMENT_SCREEN) > end > end > =20 > if __FILE__ =3D=3D $0 > FXApp.new("test7", "test") do |theApp| > TestWindow.new(theApp) > theApp.create > theApp.run > end > end=20 > ############################################################## > ####################### > This email has been scanned by MailMarshal, an email content=20 > filter.=20 > ############################################################## > ####################### >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President=20 > and CEO of GenToo technologies. Learn everything from=20 > fundamentals to system=20 > administration.http://ads.osdn.com/?ad_id=1470&alloc_id638&op=3Dick > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users >=20 #########################################################################= ############ This email has been scanned by MailMarshal, an email content filter. #########################################################################= ############ |
From: Daniel S. <da...@pr...> - 2004-03-11 02:11:11
|
Eeep. And now more segfaults. Either I'm missing out on some fundamentals here, or there's much bugginess about. Once I connect to SEL_DELETED on a @treeList, I get a segfault on exit if the tree isn't empty. If I run the following program and exit immediately, I get a segfault. If I click the item (removing it), it exits cleanly. --- class TestWindow < FXMainWindow =20 def initialize(parent) =20 super(parent, "test", nil, nil, DECOR_ALL, 0, 0, 400, 300) =20 @treeList =3D FXTreeList.new(self, 0) =20 @treeList.connect(SEL_DELETED) { |a,b,item| puts "deleted"} =20 @treeList.connect(SEL_CLICKED) { |a,b,item| @treeList.removeItem(item, true); puts "removed"} =20 item =3D @treeList.addItemLast(nil, FXTreeItem.new("hello"), true) =20 end =20 def create =20 super =20 show(PLACEMENT_SCREEN) =20 end end =20 =20 if __FILE__ =3D=3D $0 =20 FXApp.new("test7", "test") do |theApp| =20 TestWindow.new(theApp) =20 theApp.create =20 theApp.run =20 end end #########################################################################= ############ This email has been scanned by MailMarshal, an email content filter. #########################################################################= ############ |
From: Daniel S. <da...@pr...> - 2004-03-11 01:58:26
|
I've been getting a segmentation fault from my code upon exit, and have managed to track it down with the following test code. When I switch the order of the connect and addItemLast lines, the segmentation fault goes away. Is it a rule that a connect cannot be issued after the event has been triggered? Will it fail if ANY connect is called after ANY event has been handled by the object? ---- require 'fox' include Fox class TestWindow < FXMainWindow =20 def initialize(parent) =20 super(parent, "test", nil, nil, DECOR_ALL, 0, 0, 400, 300) =20 @treeList =3D FXTreeList.new(self, 0) =20 @treeList.addItemLast(nil, FXTreeItem.new("hello"), true) =20 @treeList.connect(SEL_INSERTED) { |a,b,item| puts "hello"} =20 end =20 def create =20 super =20 show(PLACEMENT_SCREEN) =20 end end =20 =20 if __FILE__ =3D=3D $0 =20 FXApp.new("test7", "test") do |theApp| =20 TestWindow.new(theApp) =20 theApp.create =20 theApp.run =20 end end #########################################################################= ############ This email has been scanned by MailMarshal, an email content filter. #########################################################################= ############ |
From: David L H. <Dav...@co...> - 2004-03-09 05:13:11
|
> Today's Topics: > > 1. makePositionVisible() fails in FXList, FXTreeList (David L Hawley) > > Message: 1 > Date: Sun, 07 Mar 2004 20:21:46 -0800 > To: fxr...@li... > From: David L Hawley <Dav...@co...> > Subject: [Fxruby-users] makePositionVisible() fails in FXList, FXTreeList > Reply-To: fxr...@li... > > 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? > > Message: 3 > From: jeroen <je...@fo...> > Organization: FOX Toolkit > To: David L Hawley <Dav...@co...> > Subject: Re: [Fxruby-users] makePositionVisible() fails in FXList, > FXTreeList > Date: Mon, 8 Mar 2004 07:59:06 -0600 > Cc: fxr...@li... > Reply-To: fxr...@li... > > The thing to remember is that makeItemVisible() can't work until the > item sizes have been determined. The widget's contents are measured > AFTER create() has been called, and AFTER a layout() has been performed. > > So, if you've just added an item, make sure the item is created, and > then call layout() on the widget to force a size-computation. Now > makeItemVisible() knows all the information to do its thing. > > Hope this helps, > > > Jeroen > Jeroen, Thankyou, this is makes sense, however the FXRuby implimentation appears to hide create() and layout() - at least I don't see those methods listed for any FXRuby objects I've looked at. On the otherhand, I can put a "scroll to end" button with a connect command @cmdOutput.makeItemVisible(@cmdOutput.lastItem) and scroll does work. So the question is where to place the makeItemVisible call. OK, here's a kludge - I can add into my onTimeout method and have it fire when there's no input from the serial port. This works, although I don't like it. It would appear that the FXRuby call is broken in some respect. Dave |
From: Tom <tku...@so...> - 2004-03-09 00:32:32
|
I sort of answered my own question. I wrapped the long-running piece in a Thread.new, with its last statement removing the 100ms timeout, and everything works the way it should now. At least that's what I think! Is there any reason to not do that? Tom Tom wrote: > Hi all, > > I have tried both chores & 100ms timeouts, but neither seem to fire. > I am wrapping a bunch of DB calls inside the chore, and the chore > never fires. I tried the same thing with a 100ms timeout, and after > 100ms the timeout never fired. Is there some threshold of busy-ness > that chores and timeouts do not occur above? The function which does > the chore resets the chore-call back to itself, so it's not an issue > of firing once and never again, it's that it never fires in the first > place. Same thing with the timeout. I display a timer on the start & > finish of each function. Well over 250ms passes during the db updates > and the 100ms timeout never fires. > Any thoughts would be appreciated. > > Tom > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users > > |
From: Tom <tku...@so...> - 2004-03-08 22:00:50
|
Hi all, I have tried both chores & 100ms timeouts, but neither seem to fire. I am wrapping a bunch of DB calls inside the chore, and the chore never fires. I tried the same thing with a 100ms timeout, and after 100ms the timeout never fired. Is there some threshold of busy-ness that chores and timeouts do not occur above? The function which does the chore resets the chore-call back to itself, so it's not an issue of firing once and never again, it's that it never fires in the first place. Same thing with the timeout. I display a timer on the start & finish of each function. Well over 250ms passes during the db updates and the 100ms timeout never fires. Any thoughts would be appreciated. Tom |
From: jeroen <je...@fo...> - 2004-03-08 14:14:57
|
On Sunday 07 March 2004 10:21 pm, David L Hawley wrote: > 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? The thing to remember is that makeItemVisible() can't work until the item sizes have been determined. The widget's contents are measured AFTER create() has been called, and AFTER a layout() has been performed. So, if you've just added an item, make sure the item is created, and then call layout() on the widget to force a size-computation. Now makeItemVisible() knows all the information to do its thing. Hope this helps, Jeroen -- +----------------------------------------------------------------------------+ | Copyright (C) 23:50 12/11/2003 Jeroen van der Zijp. All Rights Reserved. | +----------------------------------------------------------------------------+ |
From: jeroen <je...@fo...> - 2004-03-08 05:18:05
|
On Sunday 07 March 2004 05:38 pm, Lyle Johnson wrote: > On Mar 7, 2004, at 12:36 PM, John Reed wrote: > > I don=E2=80=99t know how to capture the SEL_CLOSE event in my program= because > > if the dialog box used in the program for data entry is open, and > > there have been changes, I want to warn the user about those changes. > > I tried attaching the .connect(SEL_CLOSE) to the contents object, but > > that didn=E2=80=99t work. > > No, there's no point in connecting SEL_CLOSE on the "contents" object > since it's a vertical frame and not an FXMainWindow. I *started* to say > that this shouldn't be a big deal, because if you display the dialog > box modally, the user wouldn't be able to click the main window's close > button. But I just ran a quick test and it doesn't appear that modality > of a dialog box prevents you from closing the application's main window > (this was a surprise to me). Small correction: this is indeed the case for FOX 1.0; for 1.1, only the currently active (topmost) modal window may be closed this way... [In FOX 1.0, closing one of the "underlying" windows effectively caused all stacked windows to behave as if closed. In many cases, this worked fine but of course we don't know what a modal dialog does when its cancelled so its better not to have such surprises] - Jeroen --=20 +------------------------------------------------------------------------= ----+ | Copyright (C) 23:50 12/11/2003 Jeroen van der Zijp. All Rights Reserv= ed. | +------------------------------------------------------------------------= ----+ |