From: Kent D. <ke...@st...> - 2001-09-24 13:16:07
|
Hi. I want to use Ruby-Fltk as a way of developing Ruby apps for my PDA, an Agenda VR3. I finally managed to compile it in statically in miniruby yesterday, and have the samples up and running on it. I'd like to keep the scripts as portable as possible between the PDA and host computer. One problem in that respect, is with fontsizes. Is there any way of setting the default fontsize in Ruby-Fltk? Changing the FLTK itself isn't really a viable option. Also, I noticed that setting the labelsize for widgets such as Fltk::Widget don't affect the size of the input text. According to FLTK API for 1.0.10, there is the methods called textsize, which I can't find in Ruby-Fltk. Nice work, btw. -- <[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]> )____(stud.techn.;ind.øk.data)||(softwareDeveloper.at(Trustix))_( /"Opinions expressed are mine and not those of my Employer, "\ ( "the University, my girlfriend, stray cats, banana fruitflies, " ) \"nor the frontal lobe of my left cerebral hemisphere. "/ |
From: Kent D. <ke...@st...> - 2001-09-30 14:40:27
|
Hi. I just started playing around and changing the ListBox to accomodate my needs. When I did that, I noticed something that appears to work not quite as FLTK does when you're using C++, and confused me for a few seconds :-) After populating the HoldBrowser with data... @transactionlist.add("Some text", objectItRefersTo) And setting up a callback: @transactionlist.callback do |a,b| puts a.value.to_s + ":" + a.data(a.value).to_s + ";" + b end ...I still get b==nil. Its not an immediate problem, as I can get the data thru the browser object, but since most Fltk callbacks use the idiom of a widget pointer and a void pointer as arguments in C++, this caught me by surprise. Reading /ruby-fltk/doc/en/guide.txtand especially 3.2 seems to be somewhat misleading on this subject, as it states that only the data should be passed. I'm assuming it should say that the widget itself and the data will be passed. (Or is this changing?) -- <[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]> )____(stud.techn.;ind.øk.data)||(softwareDeveloper.at(Trustix))_( /"Opinions expressed are mine and not those of my Employer, "\ ( "the University, my girlfriend, stray cats, banana fruitflies, " ) \"nor the frontal lobe of my left cerebral hemisphere. "/ |
From: Takaaki T. <tt...@kt...> - 2001-09-30 17:00:44
|
At Sun, 30 Sep 2001 16:48:18 -0400, Kent Dahl <ke...@st...> wrote: > ...I still get b==nil. Its not an immediate problem, as I can get the > data thru the browser object, but since most Fltk callbacks use the > idiom of a widget pointer and a void pointer as arguments in C++, this > caught me by surprise. If you'd like to get non-nil value, give the data like this: @transactionlist.callback(somedata){ ... } > Reading /ruby-fltk/doc/en/guide.txtand especially 3.2 seems to be > somewhat misleading on this subject, as it states that only the data > should be passed. I'm assuming it should say that the widget itself and > the data will be passed. (Or is this changing?) Here is a part of FLTK manual: Each line contains a null-terminated string of text and a void * data pointer. The text string is displayed, the void * pointer can be used by the callbacks to reference the object the text describes. If I don't misunderstand, I think this description mention something like "a.data(a.value)" in your code, and the void * pointer (= "a.data(a.value)") *can* be used in the callback block. @transactionlist.callback do |a,b| puts a.value.to_s + ":" + a.data(a.value).to_s + ";" + b end But I don't be assure of my thought. -- Takaaki Tateishi <tt...@kt...> |
From: Kent D. <ke...@st...> - 2001-09-30 18:20:50
|
Takaaki Tateishi wrote: > If you'd like to get non-nil value, give the data like this: > > @transactionlist.callback(somedata){ ... } Well, the problem was, that transactionlist is a Fltk::HoldBrowser, which has one callback, but a list of entries. Maybe I've misunderstood Fltk on this part, since the obvious, useful thing for me when I have a select callback, is the structure it represents and not some toplevel object assosiated solely with the Browser... If I think hard about it, I realize that it would break the way callbacks work everywhere else in FLTK where 1 widget -> 1 callback -> 1 user data. > Here is a part of FLTK manual: > > Each line contains a null-terminated string of text and a void * data pointer. > The text string is displayed, the void * pointer can be used by the callbacks > to reference the object the text describes. > > If I don't misunderstand, I think this description mention > something like "a.data(a.value)" in your code, > and the void * pointer (= "a.data(a.value)") *can* be used > in the callback block. I'll buy that now. When I read "void * pointer can be used by callbacks" before I just assumed that it was the closest pointer to the callback, the one it gets as an argument... I'm off to kick myself a bit now :-) -- <[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]> )____(stud.techn.;ind.øk.data)||(softwareDeveloper.at(Trustix))_( /"Opinions expressed are mine and not those of my Employer, "\ ( "the University, my girlfriend, stray cats, banana fruitflies, " ) \"nor the frontal lobe of my left cerebral hemisphere. "/ |
From: Kent D. <ke...@st...> - 2001-11-15 15:43:25
|
Hi. I'm trying to get Ruby 1.6.5 up and running on my Agenda VR3, with more extensions than last time. I copied the ruby-fltk (v0.3) into the ext/ folder, added ruby-fltk to the ext/Setup and ran ./configure --with-static-ext in the ruby directory, and them make. I noticed that Ruby-FLTK isn't configured nor compiled when I do this. (I also added XMLParser, for which the same procedure worked.) Also, there are some hard-codings in the Makefile, that makes it necessary to edit the makefile to cross-compile. (I use "export CC=mipsel-linux-gcc", which doesn't work with the current Ruby-FLTK makefile, since it defined CC directly) Would it be worth the effort to change the make config of Ruby-FLTK to work "magically" with the ruby compilation configuration, such as XMLParser aparently does? -- <[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]> )____(stud.techn.;ind.øk.data)||(softwareDeveloper.at(Trustix))_( /"Opinions expressed are mine and not those of my Employer, "\ ( "the University, my girlfriend, stray cats, banana fruitflies, " ) \"nor the frontal lobe of my left cerebral hemisphere. "/ |
From: Kevin S. <kev...@ya...> - 2001-11-15 20:13:13
|
--- Kent Dahl <ke...@st...> wrote: > Would it be worth the effort to change the make config of > Ruby-FLTK to work "magically" with the ruby compilation > configuration, such as XMLParser aparently does? That sounds great to me. Unfortunately, I know almost nothing about packaging, so someone other than me would have to take care of this. Kevin __________________________________________________ Do You Yahoo!? Find the one for you at Yahoo! Personals http://personals.yahoo.com |
From: Takaaki T. <tt...@kt...> - 2001-11-16 01:03:21
|
At Thu, 15 Nov 2001 16:53:47 -0500, Kent Dahl <ke...@st...> wrote: > I noticed that Ruby-FLTK isn't configured nor compiled when I do this. > (I also added XMLParser, for which the same procedure worked.) I guess it was caused by missing MANIFEST file. How about updating the following two file? http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ruby-fltk/ruby-fltk/MANIFEST http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ruby-fltk/ruby-fltk/extconf.rb Regards, -- Takaaki Tateishi <tt...@kt...> |
From: Kent D. <ke...@st...> - 2001-11-16 08:37:42
|
Takaaki Tateishi wrote: > I guess it was caused by missing MANIFEST file. > How about updating the following two file? Thank you, that worked wonders! -- <[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]> )____(stud.techn.;ind.øk.data)||(softwareDeveloper.at(Trustix))_( /"Opinions expressed are mine and not those of my Employer, "\ ( "the University, my girlfriend, stray cats, banana fruitflies, " ) \"nor the frontal lobe of my left cerebral hemisphere. "/ |
From: Kent D. <ke...@st...> - 2001-09-24 13:52:42
|
Kent Dahl wrote: > Also, I noticed that setting the labelsize for widgets such as > Fltk::Widget don't affect the size of the input text. According to FLTK > API for 1.0.10, there is the methods called textsize, which I can't find > in Ruby-Fltk. Fixing that wasn't too hard: <SNIP> [kentda@v128a ruby-fltk]$ cvs diff cvs server: Diffing . Index: flinput.cc =================================================================== RCS file: /cvsroot/ruby-fltk/ruby-fltk/flinput.cc,v retrieving revision 1.9 diff -r1.9 flinput.cc 24a25 > static FN_GETSET_INT(Input_,textsize); 128a130 > DEF_METHOD_EQ(Input_,textsize,-1); cvs server: Diffing doc </SNIP> -- <[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]> )____(stud.techn.;ind.øk.data)||(softwareDeveloper.at(Trustix))_( /"Opinions expressed are mine and not those of my Employer, "\ ( "the University, my girlfriend, stray cats, banana fruitflies, " ) \"nor the frontal lobe of my left cerebral hemisphere. "/ |
From: Takaaki T. <tt...@kt...> - 2001-09-24 14:10:39
|
At Mon, 24 Sep 2001 15:22:55 -0400, Kent Dahl <ke...@st...> wrote: > I want to use Ruby-Fltk as a way of developing Ruby apps for my PDA, an That's great! > I'd like to keep the scripts as portable as possible between the PDA and > host computer. One problem in that respect, is with fontsizes. Is there > any way of setting the default fontsize in Ruby-Fltk? Changing the FLTK > itself isn't really a viable option. FLTK has the fl_font() which is used for setting the font's face and size. Is this what you want? But Ruby-FLTK don't provide it yet. # Thank you for Input_#textsize. I've added it now. -- Takaaki Tateishi <tt...@kt...> |
From: Kevin S. <kev...@ya...> - 2001-09-24 15:35:35
|
--- Kent Dahl <ke...@st...> wrote: > Is there any way of setting the default fontsize in Ruby-Fltk? > Changing the FLTK itself isn't really a viable option. That's a great idea (if I understand you correctly). We could have a method, something like Fltk::default_fontsize, which would return the default, or allow you to set a new default. All widgets that got created could automatically invoke fontsize with this value. I think we would have to implement this in C++, and not in the Ruby layer. We could easily add it to our contructor body, since we only have a couple of them. And the Fltk initialize could either pick a default default, or create a raw Fltk widget, ask for the fontsize, and then destroy the widget. At some point, we could also add features to set default colors and other options this way. Of course, with Fltk2, themes should solve all of this, so we don't want to do too much with it right now. What do you think? Kevin P.S. to Kent: Thanks for the code contribution! One of our goals was that it be quick and easy to enhance and modify. __________________________________________________ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com |