lol, you are trying around pretty crazy things :) .. I''ll give you a
hint:
you better not try around so much and instead read the docs more precisely.
read this
http://www.fxruby.org/doc/events.html
here it is written pretty unmistakable how to do it. with working code!
-- henon
On Fri, Nov 6, 2009 at 7:48 AM, dave L <dglnz at yahoo.com> wrote:
> Well just tried this code now and got the error below it.
>
> def hello
> #@PSlist2.appendItem(''Hello'' <%23 at
PSlist2.appendItem%28%27Hello%27>)
> puts ''hello''
> end
>
> def init
>
> @topwin.resize(958,670)
>
>
> aTimer = @topwin.addTimeout(1000, method(:hello))
> ....
>
> end
>
> >rubyw mymainwin3.rbw
> mymainwin3.rbw:39:in `init'': undefined method
`addTimeout'' for
> #<FX::MainWindow:0x40636ec> (NoMethodError)
> from ./multitabwin3.rb:6:in `initialize''
> from mymainwin3.rbw:13:in `initialize''
> from mymainwin3.rbw:106:in `new''
> from mymainwin3.rbw:106
> >Exit code: 1
> because of this error think i had tried other variations as per my original
> email to you.
>
> have also tried aTimer = addTimeout.new and also added in a require
> ''timeout'' statement into the program just in case i had
to add in the file
> without realising it from documentation.
>
> Now i''ve tried something a bit left field.
>
> this is my thinking be it right or wrong...
>
> because the error shown implies there is NO object created i added this in
> the unit test code...
>
> #unit test
> if __FILE__==$0
> require ''libGUIb16''
> app=FX::App.new
> w=Fxwindow_code.new app
> w.topwin.show(Fox::PLACEMENT_SCREEN)
> @aTimer = app.addTimeout.new<<<< in case i needed to create
the object
> 1st.
> app.create
> app.run
> end
> now i have this code
>
> giving me the error below...
> def init
>
> @topwin.resize(958,670)
>
> @aTimer {1000 :hello}
> >rubyw mymainwin3.rbw
> mymainwin3.rbw:39: syntax error, unexpected ''{'',
expecting kEND
> @aTimer {1000 :hello}
> ^
> >Exit code: 1
>
> have tried replacing the {} with DO and END but got an error $end expected.
> tried brackets but got unexpected () encountered.
>
> could you send me a work piece of code?
>
> like a listbox , toggle button
>
> push button and timer is started, after timeout text apended to the
> listbox, push button again and timeout is removed?
>
> that way i can see what errors i get (esp if you wroked sample fails).
>
> rgds,
>
> Dave.
>
> ------------------------------
> *From:* Meinrad Recheis <meinrad.recheis at gmail.com>
> *To:* dave L <dglnz at yahoo.com>
>
> *Cc:* fxruby-users at rubyforge.org
> *Sent:* Thu, 5 November, 2009 11:05:39 PM
>
> *Subject:* Re: Timer function usage
>
> you need to give it a method:
>
> aTimer = @topwin.addTimeout(1000, method(:hello))
>
>
> hth,
> -- henon
>
> On Thu, Nov 5, 2009 at 9:42 AM, dave L <dglnz at yahoo.com> wrote:
>
>> Hi Meinrad,
>>
>> I have been battling with trying to get the timer event to work -
wanting
>> to have an event/methd run every X minutes.
>>
>> from my reading of things this should work but it fails with no
>> methoderror.
>>
>> aTimer = @topwin.addTimeout(1000, (:hello))
>>
>> Hello is a define method further up in code - currently it puts hello
to a
>> listbox every second as proof of it working.
>>
>> also tried this.
>>
>> aTimer = Timer.new
>> aTimer = @topwin.addTimeout(1000, (:hello))
>>
>> my ultimate aim is to have it reset after countdown so it''s a
continous
>> timer to fire an event that will request a read from a database
(thinking in
>> memory SQLlite at present) and refresh the listbox.
>>
>> Oh i did get over my other issues (more of a work around but still) -
>> that''s all working now <sheepish grin>
>>
>> dave.
>>
>>
>>
>> Email slow, clunky, unreliable? Switch to Yahoo!Xtra
Mail<http://au.rd.yahoo.com/nz/mail/tagline/2009/mailsignup/*http://yahoo.co.nz/mail>,
>> New Zealand''s new email address.
>>
>
>
> Need mail bonding? Bring all your contacts to Yahoo!Xtra with
TrueSwitch<http://au.rd.yahoo.com/nz/mail/tagline/2009/trueswitch/*http://help.yahoo.com/l/nz/yahooxtra/mail/yahoomail/manage/manage-66.html>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/fxruby-users/attachments/20091106/aa35c23c/attachment.html>