Timer control

View: New views
3 Messages — Rating Filter:   Alert me  

Timer control

by dglnz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Was wondering if anyone could via small piece of code show how a timer is envoked.

Sometimes (at least for me) a worked sample (with some documentation) is better than having something explained in words.

I would be grateful,

Dave



Email slow, clunky, unreliable? Switch to Yahoo!Xtra Mail, New Zealand's new email address.
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Timer control

by Joey Kinsella :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Simple, hope this helps...

class ProgressDlg < FXMainWindow
  def initialize(app, caption, text)
    @app = app
    super(@app, caption, :opts => DECOR_NONE, :width => 520, :height => 40)

    FXLabel.new(self, text, :opts => LAYOUT_FILL_X | JUSTIFY_CENTER_X)
    @bar = FXProgressBar.new(self, :opts => PROGRESSBAR_NORMAL | LAYOUT_FILL_X)
  end

  def create
    super
    show(PLACEMENT_SCREEN)
  end

  def run(limit = 100)
    @bar.setTotal(limit)
    @bar.setProgress(0)

    @app.addTimeout(1000, method(:progress_update))
  end

  def progress_update(sender, selector, data)
    @bar.increment(1)

    if @bar.progress == @bar.total
      self.close(true)
    else
      @app.addTimeout(1000, method(:progress_update))
    end
  end
end

On Mon, Nov 2, 2009 at 2:51 AM, dave L <dglnz@...> wrote:
Was wondering if anyone could via small piece of code show how a timer is envoked.

Sometimes (at least for me) a worked sample (with some documentation) is better than having something explained in words.

I would be grateful,

Dave



Email slow, clunky, unreliable? Switch to Yahoo!Xtra Mail, New Zealand's new email address.

_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

--
If you are not the intended recipient, you are hereby notified
that any dissemination, distribution, copying or other use of
this communication is strictly prohibited.  If you have
received this communication in error, please notify us
immediately.


_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Timer control

by dglnz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

@Joey,

Many thanks for the help.

I ended up looking at some sample source code and was able to butcher that to get me going.

REALLY appreciate your time as this list is low volume (and i am using foxGUIb) for the screen and window control display which has helped me visualise placement.

again many thanks for the time.

dave.


--- On Thu, 3/12/09, Joey Kinsella <jkinsella@...> wrote:

> From: Joey Kinsella <jkinsella@...>
> Subject: Re: [fxruby-users] Timer control
> To: fxruby-users@...
> Received: Thursday, 3 December, 2009, 6:46 AM
> Simple, hope this helps...
>
> class ProgressDlg < FXMainWindow
>   def initialize(app, caption, text)
>     @app = app
>     super(@app, caption, :opts => DECOR_NONE, :width
> => 520, :height => 40)
>
>
>     FXLabel.new(self, text, :opts => LAYOUT_FILL_X |
> JUSTIFY_CENTER_X)
>     @bar = FXProgressBar.new(self, :opts =>
> PROGRESSBAR_NORMAL | LAYOUT_FILL_X)
>   end
>
>   def create
>     super
>     show(PLACEMENT_SCREEN)
>
>   end
>
>   def run(limit = 100)
>     @bar.setTotal(limit)
>     @bar.setProgress(0)
>
>     @app.addTimeout(1000, method(:progress_update))
>   end
>
>   def progress_update(sender, selector, data)
>     @bar.increment(1)
>
>
>     if @bar.progress == @bar.total
>       self.close(true)
>     else
>       @app.addTimeout(1000, method(:progress_update))
>     end
>   end
> end
>
> On Mon, Nov 2, 2009 at 2:51 AM,
> dave L <dglnz@...>
> wrote:
>
> Was wondering if
> anyone could via small piece of code show how a timer is
> envoked.
>
>
> Sometimes (at least for me) a worked sample (with some
> documentation) is better than having something explained in
> words.
>
> I would be grateful,
>
> Dave
>
>
>
>
>
>
>
>
>       Email slow, clunky, unreliable? Switch to Yahoo!Xtra Mail, New
> Zealand's new email address.
> _______________________________________________
>
> fxruby-users mailing list
>
> fxruby-users@...
>
> http://rubyforge.org/mailman/listinfo/fxruby-users
>
>
>
> --
> If you are not the intended recipient, you are hereby
> notified
> that any dissemination, distribution, copying or other use
> of
> this communication is strictly prohibited.  If you have
> received this communication in error, please notify us
> immediately.
>

> -----Inline Attachment Follows-----
>
> _______________________________________________
> fxruby-users mailing list
> fxruby-users@...
> http://rubyforge.org/mailman/listinfo/fxruby-users


     
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users