Jsoftware
High-Performance Development Platform

progress bar

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

progress bar

by Matthew Brand-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there a library of "widgets" or does anybody have any code that can
display some kind of progress bar.
E.g.

init_progressBar_ 10 NB. there will be 10 steps to 100% completion

for_i i.10 do.
  NB. do calculation step here...
  update_progressBar_ i NB. alter progress bar to position i
end.

end_progressBar_ '' NB. stop displaying the progress bar.

Just thought I would ask if this already exists before trying to write
something to do it.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Parent Message unknown Re: progress bar

by Anssi Seppälä :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here is a progressbar class I use:
NB. Progressbar
NB. Example:
NB.    a=:'Title' conew 'pASepProgressBar'
NB.    proge_run__a ''
NB.    'info' set__a 20
NB.    close__a ''
NB.    destroy__a ''


coclass 'pASepProgressBar'

NB. =========================================================
NB.*create v takes caption for the form
create=: 3 : 0
out=: 0$' '
caption=: y
cancelpressed=: 0
)

NB. =========================================================
NB.*destroy v codestroy
destroy=: codestroy

NB. =========================================================
NB.*PROGE n pc proge form definition
PROGE=: 0 : 0
pc proge;
xywh 6 16 172 11;cc ccprogress progress ws_border;
xywh 6 3 173 10;cc info static;cn "";
pas 6 6;pcenter;
rem form end;
)

NB. =========================================================
NB.*run v run form
run=: 3 : 0
wd PROGE
wd 'pn *',caption
NB. initialize form here
wd 'ptop 1'
seticon ''
wd 'pshow;'
)

close=: 3 : 0
wd'pclose'
)

NB. =========================================================
NB.*set v set pbar
set=: 4 : 0
wd 'set info *',x
wd 'set ccprogress ',":y
)

NB. =========================================================
NB.*close v set pbar
close=: 3 : 0
wd 'pclose;'
)




At 18:28 11.10.2009, you wrote:

>Is there a library of "widgets" or does anybody have any code that can
>display some kind of progress bar.
>E.g.
>
>init_progressBar_ 10 NB. there will be 10 steps to 100% completion
>
>for_i i.10 do.
>   NB. do calculation step here...
>   update_progressBar_ i NB. alter progress bar to position i
>end.
>
>end_progressBar_ '' NB. stop displaying the progress bar.
>
>Just thought I would ask if this already exists before trying to write
>something to do it.
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by David Mitchell-13 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

For Windows, there is this:

http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog

or the WD object progressbar:

http://www.jsoftware.com/help/user/wd_commands.htm

You can see the WD progress bar in action in the "controls" demo on the bottom
of the "selects" tab.
--
David Mitchell

Matthew Brand wrote:

> Is there a library of "widgets" or does anybody have any code that can
> display some kind of progress bar.
> E.g.
>
> init_progressBar_ 10 NB. there will be 10 steps to 100% completion
>
> for_i i.10 do.
>   NB. do calculation step here...
>   update_progressBar_ i NB. alter progress bar to position i
> end.
>
> end_progressBar_ '' NB. stop displaying the progress bar.
>
> Just thought I would ask if this already exists before trying to write
> something to do it.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by Matthew Brand-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I can't get the pASepProgressBar class to work.

I am trying to understand how it works so I wrote this:

wd 0 : 0
pc proge;
xywh 6 16 172 11;cc ccprogress progress ws_border;
xywh 6 3 173 10;cc info static;cn "";
pas 6 6;pcenter;
rem form end;
pshow;
set info 50
)
wd 'set info 40'

If I highlight it all and press ctrl-R then it works as expected with the
info label set to 40.

But if I try to run  wd 'set info 40' after that, I get an error:

   wd 'set info 40'
|domain error: wd
|       wd'set info 40'
|[-0]

   wd 'qer'
bad id : 0

How do I tell the wd command that I am referring to the info control inside
the window (parent?)  proge?

What should I write instead of:
   wd 'set info 40'

Thanks,
Matthew.


2009/10/11 David Mitchell <davidmitchell@...>

> For Windows, there is this:
>
> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog
>
> or the WD object progressbar:
>
> http://www.jsoftware.com/help/user/wd_commands.htm
>
> You can see the WD progress bar in action in the "controls" demo on the
> bottom
> of the "selects" tab.
> --
> David Mitchell
>
> Matthew Brand wrote:
> > Is there a library of "widgets" or does anybody have any code that can
> > display some kind of progress bar.
> > E.g.
> >
> > init_progressBar_ 10 NB. there will be 10 steps to 100% completion
> >
> > for_i i.10 do.
> >   NB. do calculation step here...
> >   update_progressBar_ i NB. alter progress bar to position i
> > end.
> >
> > end_progressBar_ '' NB. stop displaying the progress bar.
> >
> > Just thought I would ask if this already exists before trying to write
> > something to do it.
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by Matthew Brand-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

"I am trying to understand how it works so I wrote this" ... well
actually I mainly copy/pasted it from pASepProgressBar :-).

2009/11/10 Matthew Brand <mtthwbrnd@...>:

> I can't get the pASepProgressBar class to work.
> I am trying to understand how it works so I wrote this:
> wd 0 : 0
> pc proge;
> xywh 6 16 172 11;cc ccprogress progress ws_border;
> xywh 6 3 173 10;cc info static;cn "";
> pas 6 6;pcenter;
> rem form end;
> pshow;
> set info 50
> )
> wd 'set info 40'
> If I highlight it all and press ctrl-R then it works as expected with the
> info label set to 40.
> But if I try to run  wd 'set info 40' after that, I get an error:
>    wd 'set info 40'
> |domain error: wd
> |       wd'set info 40'
> |[-0]
>    wd 'qer'
> bad id : 0
> How do I tell the wd command that I am referring to the info control inside
> the window (parent?)  proge?
> What should I write instead of:
>    wd 'set info 40'
> Thanks,
> Matthew.
>
> 2009/10/11 David Mitchell <davidmitchell@...>
>>
>> For Windows, there is this:
>>
>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog
>>
>> or the WD object progressbar:
>>
>> http://www.jsoftware.com/help/user/wd_commands.htm
>>
>> You can see the WD progress bar in action in the "controls" demo on the
>> bottom
>> of the "selects" tab.
>> --
>> David Mitchell
>>
>> Matthew Brand wrote:
>> > Is there a library of "widgets" or does anybody have any code that can
>> > display some kind of progress bar.
>> > E.g.
>> >
>> > init_progressBar_ 10 NB. there will be 10 steps to 100% completion
>> >
>> > for_i i.10 do.
>> >   NB. do calculation step here...
>> >   update_progressBar_ i NB. alter progress bar to position i
>> > end.
>> >
>> > end_progressBar_ '' NB. stop displaying the progress bar.
>> >
>> > Just thought I would ask if this already exists before trying to write
>> > something to do it.
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> >
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by Don Guinn-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think that the form is not the current parent. Try

   wd 'psel proge;set info 40'


On Tue, Nov 10, 2009 at 6:21 AM, Matthew Brand <mtthwbrnd@...>wrote:

> "I am trying to understand how it works so I wrote this" ... well
> actually I mainly copy/pasted it from pASepProgressBar :-).
>
> 2009/11/10 Matthew Brand <mtthwbrnd@...>:
> > I can't get the pASepProgressBar class to work.
> > I am trying to understand how it works so I wrote this:
> > wd 0 : 0
> > pc proge;
> > xywh 6 16 172 11;cc ccprogress progress ws_border;
> > xywh 6 3 173 10;cc info static;cn "";
> > pas 6 6;pcenter;
> > rem form end;
> > pshow;
> > set info 50
> > )
> > wd 'set info 40'
> > If I highlight it all and press ctrl-R then it works as expected with the
> > info label set to 40.
> > But if I try to run  wd 'set info 40' after that, I get an error:
> >    wd 'set info 40'
> > |domain error: wd
> > |       wd'set info 40'
> > |[-0]
> >    wd 'qer'
> > bad id : 0
> > How do I tell the wd command that I am referring to the info control
> inside
> > the window (parent?)  proge?
> > What should I write instead of:
> >    wd 'set info 40'
> > Thanks,
> > Matthew.
> >
> > 2009/10/11 David Mitchell <davidmitchell@...>
> >>
> >> For Windows, there is this:
> >>
> >> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog
> >>
> >> or the WD object progressbar:
> >>
> >> http://www.jsoftware.com/help/user/wd_commands.htm
> >>
> >> You can see the WD progress bar in action in the "controls" demo on the
> >> bottom
> >> of the "selects" tab.
> >> --
> >> David Mitchell
> >>
> >> Matthew Brand wrote:
> >> > Is there a library of "widgets" or does anybody have any code that can
> >> > display some kind of progress bar.
> >> > E.g.
> >> >
> >> > init_progressBar_ 10 NB. there will be 10 steps to 100% completion
> >> >
> >> > for_i i.10 do.
> >> >   NB. do calculation step here...
> >> >   update_progressBar_ i NB. alter progress bar to position i
> >> > end.
> >> >
> >> > end_progressBar_ '' NB. stop displaying the progress bar.
> >> >
> >> > Just thought I would ask if this already exists before trying to write
> >> > something to do it.
> >> > ----------------------------------------------------------------------
> >> > For information about J forums see
> http://www.jsoftware.com/forums.htm
> >> >
> >> ----------------------------------------------------------------------
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by David Mitchell-13 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

psel is what I use:

    foo1=: 3 : 0
wd 'psel proge'
wd 'set info ',": y
wd 'set ccprogress ',": y
)

--
David Mitchell

Matthew Brand wrote:

> "I am trying to understand how it works so I wrote this" ... well
> actually I mainly copy/pasted it from pASepProgressBar :-).
>
> 2009/11/10 Matthew Brand <mtthwbrnd@...>:
>> I can't get the pASepProgressBar class to work.
>> I am trying to understand how it works so I wrote this:
>> wd 0 : 0
>> pc proge;
>> xywh 6 16 172 11;cc ccprogress progress ws_border;
>> xywh 6 3 173 10;cc info static;cn "";
>> pas 6 6;pcenter;
>> rem form end;
>> pshow;
>> set info 50
>> )
>> wd 'set info 40'
>> If I highlight it all and press ctrl-R then it works as expected with the
>> info label set to 40.
>> But if I try to run  wd 'set info 40' after that, I get an error:
>>    wd 'set info 40'
>> |domain error: wd
>> |       wd'set info 40'
>> |[-0]
>>    wd 'qer'
>> bad id : 0
>> How do I tell the wd command that I am referring to the info control inside
>> the window (parent?)  proge?
>> What should I write instead of:
>>    wd 'set info 40'
>> Thanks,
>> Matthew.
>>
>> 2009/10/11 David Mitchell <davidmitchell@...>
>>> For Windows, there is this:
>>>
>>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog
>>>
>>> or the WD object progressbar:
>>>
>>> http://www.jsoftware.com/help/user/wd_commands.htm
>>>
>>> You can see the WD progress bar in action in the "controls" demo on the
>>> bottom
>>> of the "selects" tab.
>>> --
>>> David Mitchell
>>>
>>> Matthew Brand wrote:
>>>> Is there a library of "widgets" or does anybody have any code that can
>>>> display some kind of progress bar.
>>>> E.g.
>>>>
>>>> init_progressBar_ 10 NB. there will be 10 steps to 100% completion
>>>>
>>>> for_i i.10 do.
>>>>   NB. do calculation step here...
>>>>   update_progressBar_ i NB. alter progress bar to position i
>>>> end.
>>>>
>>>> end_progressBar_ '' NB. stop displaying the progress bar.
>>>>
>>>> Just thought I would ask if this already exists before trying to write
>>>> something to do it.
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by Don Guinn-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I tried your foo1 and I couldn't get it to fail. I'm running VISTA. If you
are running under Windows you might want to look at
http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog as it
gives you a way to interrupt a long running task.

On Tue, Nov 10, 2009 at 6:35 AM, David Mitchell <davidmitchell@...>wrote:

> psel is what I use:
>
>    foo1=: 3 : 0
> wd 'psel proge'
> wd 'set info ',": y
> wd 'set ccprogress ',": y
> )
>
> --
> David Mitchell
>
> Matthew Brand wrote:
> > "I am trying to understand how it works so I wrote this" ... well
> > actually I mainly copy/pasted it from pASepProgressBar :-).
> >
> > 2009/11/10 Matthew Brand <mtthwbrnd@...>:
> >> I can't get the pASepProgressBar class to work.
> >> I am trying to understand how it works so I wrote this:
> >> wd 0 : 0
> >> pc proge;
> >> xywh 6 16 172 11;cc ccprogress progress ws_border;
> >> xywh 6 3 173 10;cc info static;cn "";
> >> pas 6 6;pcenter;
> >> rem form end;
> >> pshow;
> >> set info 50
> >> )
> >> wd 'set info 40'
> >> If I highlight it all and press ctrl-R then it works as expected with
> the
> >> info label set to 40.
> >> But if I try to run  wd 'set info 40' after that, I get an error:
> >>    wd 'set info 40'
> >> |domain error: wd
> >> |       wd'set info 40'
> >> |[-0]
> >>    wd 'qer'
> >> bad id : 0
> >> How do I tell the wd command that I am referring to the info control
> inside
> >> the window (parent?)  proge?
> >> What should I write instead of:
> >>    wd 'set info 40'
> >> Thanks,
> >> Matthew.
> >>
> >> 2009/10/11 David Mitchell <davidmitchell@...>
> >>> For Windows, there is this:
> >>>
> >>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog
> >>>
> >>> or the WD object progressbar:
> >>>
> >>> http://www.jsoftware.com/help/user/wd_commands.htm
> >>>
> >>> You can see the WD progress bar in action in the "controls" demo on the
> >>> bottom
> >>> of the "selects" tab.
> >>> --
> >>> David Mitchell
> >>>
> >>> Matthew Brand wrote:
> >>>> Is there a library of "widgets" or does anybody have any code that can
> >>>> display some kind of progress bar.
> >>>> E.g.
> >>>>
> >>>> init_progressBar_ 10 NB. there will be 10 steps to 100% completion
> >>>>
> >>>> for_i i.10 do.
> >>>>   NB. do calculation step here...
> >>>>   update_progressBar_ i NB. alter progress bar to position i
> >>>> end.
> >>>>
> >>>> end_progressBar_ '' NB. stop displaying the progress bar.
> >>>>
> >>>> Just thought I would ask if this already exists before trying to write
> >>>> something to do it.
> >>>> ----------------------------------------------------------------------
> >>>> For information about J forums see
> http://www.jsoftware.com/forums.htm
> >>>>
> >>> ----------------------------------------------------------------------
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by Matthew Brand-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Looks like you have to put the psel in the same call as the command
you want to send to the control:

wd 0 : 0
psel proge;
set info 40
)





2009/11/10 Don Guinn <donguinn@...>:

> I tried your foo1 and I couldn't get it to fail. I'm running VISTA. If you
> are running under Windows you might want to look at
> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog as it
> gives you a way to interrupt a long running task.
>
> On Tue, Nov 10, 2009 at 6:35 AM, David Mitchell <davidmitchell@...>wrote:
>
>> psel is what I use:
>>
>>    foo1=: 3 : 0
>> wd 'psel proge'
>> wd 'set info ',": y
>> wd 'set ccprogress ',": y
>> )
>>
>> --
>> David Mitchell
>>
>> Matthew Brand wrote:
>> > "I am trying to understand how it works so I wrote this" ... well
>> > actually I mainly copy/pasted it from pASepProgressBar :-).
>> >
>> > 2009/11/10 Matthew Brand <mtthwbrnd@...>:
>> >> I can't get the pASepProgressBar class to work.
>> >> I am trying to understand how it works so I wrote this:
>> >> wd 0 : 0
>> >> pc proge;
>> >> xywh 6 16 172 11;cc ccprogress progress ws_border;
>> >> xywh 6 3 173 10;cc info static;cn "";
>> >> pas 6 6;pcenter;
>> >> rem form end;
>> >> pshow;
>> >> set info 50
>> >> )
>> >> wd 'set info 40'
>> >> If I highlight it all and press ctrl-R then it works as expected with
>> the
>> >> info label set to 40.
>> >> But if I try to run  wd 'set info 40' after that, I get an error:
>> >>    wd 'set info 40'
>> >> |domain error: wd
>> >> |       wd'set info 40'
>> >> |[-0]
>> >>    wd 'qer'
>> >> bad id : 0
>> >> How do I tell the wd command that I am referring to the info control
>> inside
>> >> the window (parent?)  proge?
>> >> What should I write instead of:
>> >>    wd 'set info 40'
>> >> Thanks,
>> >> Matthew.
>> >>
>> >> 2009/10/11 David Mitchell <davidmitchell@...>
>> >>> For Windows, there is this:
>> >>>
>> >>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog
>> >>>
>> >>> or the WD object progressbar:
>> >>>
>> >>> http://www.jsoftware.com/help/user/wd_commands.htm
>> >>>
>> >>> You can see the WD progress bar in action in the "controls" demo on the
>> >>> bottom
>> >>> of the "selects" tab.
>> >>> --
>> >>> David Mitchell
>> >>>
>> >>> Matthew Brand wrote:
>> >>>> Is there a library of "widgets" or does anybody have any code that can
>> >>>> display some kind of progress bar.
>> >>>> E.g.
>> >>>>
>> >>>> init_progressBar_ 10 NB. there will be 10 steps to 100% completion
>> >>>>
>> >>>> for_i i.10 do.
>> >>>>   NB. do calculation step here...
>> >>>>   update_progressBar_ i NB. alter progress bar to position i
>> >>>> end.
>> >>>>
>> >>>> end_progressBar_ '' NB. stop displaying the progress bar.
>> >>>>
>> >>>> Just thought I would ask if this already exists before trying to write
>> >>>> something to do it.
>> >>>> ----------------------------------------------------------------------
>> >>>> For information about J forums see
>> http://www.jsoftware.com/forums.htm
>> >>>>
>> >>> ----------------------------------------------------------------------
>> >>> For information about J forums see http://www.jsoftware.com/forums.htm
>> >>
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by David Mitchell-13 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This guarantees that the correct parent form is active for subsequent commands.
  If you have multiple forms in your script (or are debugging a new form using
the J GUI, which has its own forms), the last form used is the active one.

--
David Mitchell

Matthew Brand wrote:

> Looks like you have to put the psel in the same call as the command
> you want to send to the control:
>
> wd 0 : 0
> psel proge;
> set info 40
> )
>
>
>
>
>
> 2009/11/10 Don Guinn <donguinn@...>:
>> I tried your foo1 and I couldn't get it to fail. I'm running VISTA. If you
>> are running under Windows you might want to look at
>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog as it
>> gives you a way to interrupt a long running task.
>>
>> On Tue, Nov 10, 2009 at 6:35 AM, David Mitchell <davidmitchell@...>wrote:
>>
>>> psel is what I use:
>>>
>>>    foo1=: 3 : 0
>>> wd 'psel proge'
>>> wd 'set info ',": y
>>> wd 'set ccprogress ',": y
>>> )
>>>
>>> --
>>> David Mitchell
>>>
>>> Matthew Brand wrote:
>>>> "I am trying to understand how it works so I wrote this" ... well
>>>> actually I mainly copy/pasted it from pASepProgressBar :-).
>>>>
>>>> 2009/11/10 Matthew Brand <mtthwbrnd@...>:
>>>>> I can't get the pASepProgressBar class to work.
>>>>> I am trying to understand how it works so I wrote this:
>>>>> wd 0 : 0
>>>>> pc proge;
>>>>> xywh 6 16 172 11;cc ccprogress progress ws_border;
>>>>> xywh 6 3 173 10;cc info static;cn "";
>>>>> pas 6 6;pcenter;
>>>>> rem form end;
>>>>> pshow;
>>>>> set info 50
>>>>> )
>>>>> wd 'set info 40'
>>>>> If I highlight it all and press ctrl-R then it works as expected with
>>> the
>>>>> info label set to 40.
>>>>> But if I try to run  wd 'set info 40' after that, I get an error:
>>>>>    wd 'set info 40'
>>>>> |domain error: wd
>>>>> |       wd'set info 40'
>>>>> |[-0]
>>>>>    wd 'qer'
>>>>> bad id : 0
>>>>> How do I tell the wd command that I am referring to the info control
>>> inside
>>>>> the window (parent?)  proge?
>>>>> What should I write instead of:
>>>>>    wd 'set info 40'
>>>>> Thanks,
>>>>> Matthew.
>>>>>
>>>>> 2009/10/11 David Mitchell <davidmitchell@...>
>>>>>> For Windows, there is this:
>>>>>>
>>>>>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog
>>>>>>
>>>>>> or the WD object progressbar:
>>>>>>
>>>>>> http://www.jsoftware.com/help/user/wd_commands.htm
>>>>>>
>>>>>> You can see the WD progress bar in action in the "controls" demo on the
>>>>>> bottom
>>>>>> of the "selects" tab.
>>>>>> --
>>>>>> David Mitchell
>>>>>>
>>>>>> Matthew Brand wrote:
>>>>>>> Is there a library of "widgets" or does anybody have any code that can
>>>>>>> display some kind of progress bar.
>>>>>>> E.g.
>>>>>>>
>>>>>>> init_progressBar_ 10 NB. there will be 10 steps to 100% completion
>>>>>>>
>>>>>>> for_i i.10 do.
>>>>>>>   NB. do calculation step here...
>>>>>>>   update_progressBar_ i NB. alter progress bar to position i
>>>>>>> end.
>>>>>>>
>>>>>>> end_progressBar_ '' NB. stop displaying the progress bar.
>>>>>>>
>>>>>>> Just thought I would ask if this already exists before trying to write
>>>>>>> something to do it.
>>>>>>> ----------------------------------------------------------------------
>>>>>>> For information about J forums see
>>> http://www.jsoftware.com/forums.htm
>>>>>> ----------------------------------------------------------------------
>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by Matthew Brand-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have come up with this to allow multiple progress bars. I can't work
out how to make the close window button ( the cross) make the window
disappear and destroy the progress object.

------------------------------------
coclass 'progress'

def =: 0 : 0
xywh 6 16 172 11;cc ccprogress progress ws_border;
xywh 6 3 173 10;cc info static;cn "";
pas 6 6;pcenter;
rem form end;
pshow
)

create =: 3 : 0
'wname start end' =: y
uname =: wname , > coname '' NB. unique name for wd
wd def ,~ 'pc ', uname, ';'
)

destroy =: 3 : 0
        wd 'psel ', uname, '; pclose'
        codestroy ''
)


update =: 3 : 0
pos =. ": 100 <. <. 100 * (y - start) % end - start
wd 'psel ', uname,' ; set info ', pos,'; set ccprogress ', pos ,';'
)
--------------------------------------

Example use:
load jpath , '~user/classes/progress.ijs'
p1 =. ('FirstBar';0;3) conew 'progress' NB. new progress bar scale 0 to 3
p2 =. ('SecondBar';0;9) conew 'progress' NB. new progress bar scale 0 to 9

update__p1 0
update__p2 0
update__p1 1
update__p2 5
update__p1 2
update__p1 3
update__p2 9

destroy__p1 ''
destroy__p2 ''



2009/11/11 David Mitchell <davidmitchell@...>:

> This guarantees that the correct parent form is active for subsequent commands.
>  If you have multiple forms in your script (or are debugging a new form using
> the J GUI, which has its own forms), the last form used is the active one.
>
> --
> David Mitchell
>
> Matthew Brand wrote:
>> Looks like you have to put the psel in the same call as the command
>> you want to send to the control:
>>
>> wd 0 : 0
>> psel proge;
>> set info 40
>> )
>>
>>
>>
>>
>>
>> 2009/11/10 Don Guinn <donguinn@...>:
>>> I tried your foo1 and I couldn't get it to fail. I'm running VISTA. If you
>>> are running under Windows you might want to look at
>>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog as it
>>> gives you a way to interrupt a long running task.
>>>
>>> On Tue, Nov 10, 2009 at 6:35 AM, David Mitchell <davidmitchell@...>wrote:
>>>
>>>> psel is what I use:
>>>>
>>>>    foo1=: 3 : 0
>>>> wd 'psel proge'
>>>> wd 'set info ',": y
>>>> wd 'set ccprogress ',": y
>>>> )
>>>>
>>>> --
>>>> David Mitchell
>>>>
>>>> Matthew Brand wrote:
>>>>> "I am trying to understand how it works so I wrote this" ... well
>>>>> actually I mainly copy/pasted it from pASepProgressBar :-).
>>>>>
>>>>> 2009/11/10 Matthew Brand <mtthwbrnd@...>:
>>>>>> I can't get the pASepProgressBar class to work.
>>>>>> I am trying to understand how it works so I wrote this:
>>>>>> wd 0 : 0
>>>>>> pc proge;
>>>>>> xywh 6 16 172 11;cc ccprogress progress ws_border;
>>>>>> xywh 6 3 173 10;cc info static;cn "";
>>>>>> pas 6 6;pcenter;
>>>>>> rem form end;
>>>>>> pshow;
>>>>>> set info 50
>>>>>> )
>>>>>> wd 'set info 40'
>>>>>> If I highlight it all and press ctrl-R then it works as expected with
>>>> the
>>>>>> info label set to 40.
>>>>>> But if I try to run  wd 'set info 40' after that, I get an error:
>>>>>>    wd 'set info 40'
>>>>>> |domain error: wd
>>>>>> |       wd'set info 40'
>>>>>> |[-0]
>>>>>>    wd 'qer'
>>>>>> bad id : 0
>>>>>> How do I tell the wd command that I am referring to the info control
>>>> inside
>>>>>> the window (parent?)  proge?
>>>>>> What should I write instead of:
>>>>>>    wd 'set info 40'
>>>>>> Thanks,
>>>>>> Matthew.
>>>>>>
>>>>>> 2009/10/11 David Mitchell <davidmitchell@...>
>>>>>>> For Windows, there is this:
>>>>>>>
>>>>>>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog
>>>>>>>
>>>>>>> or the WD object progressbar:
>>>>>>>
>>>>>>> http://www.jsoftware.com/help/user/wd_commands.htm
>>>>>>>
>>>>>>> You can see the WD progress bar in action in the "controls" demo on the
>>>>>>> bottom
>>>>>>> of the "selects" tab.
>>>>>>> --
>>>>>>> David Mitchell
>>>>>>>
>>>>>>> Matthew Brand wrote:
>>>>>>>> Is there a library of "widgets" or does anybody have any code that can
>>>>>>>> display some kind of progress bar.
>>>>>>>> E.g.
>>>>>>>>
>>>>>>>> init_progressBar_ 10 NB. there will be 10 steps to 100% completion
>>>>>>>>
>>>>>>>> for_i i.10 do.
>>>>>>>>   NB. do calculation step here...
>>>>>>>>   update_progressBar_ i NB. alter progress bar to position i
>>>>>>>> end.
>>>>>>>>
>>>>>>>> end_progressBar_ '' NB. stop displaying the progress bar.
>>>>>>>>
>>>>>>>> Just thought I would ask if this already exists before trying to write
>>>>>>>> something to do it.
>>>>>>>> ----------------------------------------------------------------------
>>>>>>>> For information about J forums see
>>>> http://www.jsoftware.com/forums.htm
>>>>>>> ----------------------------------------------------------------------
>>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>> ----------------------------------------------------------------------
>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by Matthew Brand-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've got another problem now. The window does not update while my
program is running :-(. So the progress bar does not progress.

Is there a command that can be issued to tell the window to redraw?


Thanks,
Matthew.

2009/11/11 Matthew Brand <mtthwbrnd@...>:

> I have come up with this to allow multiple progress bars. I can't work
> out how to make the close window button ( the cross) make the window
> disappear and destroy the progress object.
>
> ------------------------------------
> coclass 'progress'
>
> def =: 0 : 0
> xywh 6 16 172 11;cc ccprogress progress ws_border;
> xywh 6 3 173 10;cc info static;cn "";
> pas 6 6;pcenter;
> rem form end;
> pshow
> )
>
> create =: 3 : 0
> 'wname start end' =: y
> uname =: wname , > coname '' NB. unique name for wd
> wd def ,~ 'pc ', uname, ';'
> )
>
> destroy =: 3 : 0
>        wd 'psel ', uname, '; pclose'
>        codestroy ''
> )
>
>
> update =: 3 : 0
> pos =. ": 100 <. <. 100 * (y - start) % end - start
> wd 'psel ', uname,' ; set info ', pos,'; set ccprogress ', pos ,';'
> )
> --------------------------------------
>
> Example use:
> load jpath , '~user/classes/progress.ijs'
> p1 =. ('FirstBar';0;3) conew 'progress' NB. new progress bar scale 0 to 3
> p2 =. ('SecondBar';0;9) conew 'progress' NB. new progress bar scale 0 to 9
>
> update__p1 0
> update__p2 0
> update__p1 1
> update__p2 5
> update__p1 2
> update__p1 3
> update__p2 9
>
> destroy__p1 ''
> destroy__p2 ''
>
>
>
> 2009/11/11 David Mitchell <davidmitchell@...>:
>> This guarantees that the correct parent form is active for subsequent commands.
>>  If you have multiple forms in your script (or are debugging a new form using
>> the J GUI, which has its own forms), the last form used is the active one.
>>
>> --
>> David Mitchell
>>
>> Matthew Brand wrote:
>>> Looks like you have to put the psel in the same call as the command
>>> you want to send to the control:
>>>
>>> wd 0 : 0
>>> psel proge;
>>> set info 40
>>> )
>>>
>>>
>>>
>>>
>>>
>>> 2009/11/10 Don Guinn <donguinn@...>:
>>>> I tried your foo1 and I couldn't get it to fail. I'm running VISTA. If you
>>>> are running under Windows you might want to look at
>>>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog as it
>>>> gives you a way to interrupt a long running task.
>>>>
>>>> On Tue, Nov 10, 2009 at 6:35 AM, David Mitchell <davidmitchell@...>wrote:
>>>>
>>>>> psel is what I use:
>>>>>
>>>>>    foo1=: 3 : 0
>>>>> wd 'psel proge'
>>>>> wd 'set info ',": y
>>>>> wd 'set ccprogress ',": y
>>>>> )
>>>>>
>>>>> --
>>>>> David Mitchell
>>>>>
>>>>> Matthew Brand wrote:
>>>>>> "I am trying to understand how it works so I wrote this" ... well
>>>>>> actually I mainly copy/pasted it from pASepProgressBar :-).
>>>>>>
>>>>>> 2009/11/10 Matthew Brand <mtthwbrnd@...>:
>>>>>>> I can't get the pASepProgressBar class to work.
>>>>>>> I am trying to understand how it works so I wrote this:
>>>>>>> wd 0 : 0
>>>>>>> pc proge;
>>>>>>> xywh 6 16 172 11;cc ccprogress progress ws_border;
>>>>>>> xywh 6 3 173 10;cc info static;cn "";
>>>>>>> pas 6 6;pcenter;
>>>>>>> rem form end;
>>>>>>> pshow;
>>>>>>> set info 50
>>>>>>> )
>>>>>>> wd 'set info 40'
>>>>>>> If I highlight it all and press ctrl-R then it works as expected with
>>>>> the
>>>>>>> info label set to 40.
>>>>>>> But if I try to run  wd 'set info 40' after that, I get an error:
>>>>>>>    wd 'set info 40'
>>>>>>> |domain error: wd
>>>>>>> |       wd'set info 40'
>>>>>>> |[-0]
>>>>>>>    wd 'qer'
>>>>>>> bad id : 0
>>>>>>> How do I tell the wd command that I am referring to the info control
>>>>> inside
>>>>>>> the window (parent?)  proge?
>>>>>>> What should I write instead of:
>>>>>>>    wd 'set info 40'
>>>>>>> Thanks,
>>>>>>> Matthew.
>>>>>>>
>>>>>>> 2009/10/11 David Mitchell <davidmitchell@...>
>>>>>>>> For Windows, there is this:
>>>>>>>>
>>>>>>>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog
>>>>>>>>
>>>>>>>> or the WD object progressbar:
>>>>>>>>
>>>>>>>> http://www.jsoftware.com/help/user/wd_commands.htm
>>>>>>>>
>>>>>>>> You can see the WD progress bar in action in the "controls" demo on the
>>>>>>>> bottom
>>>>>>>> of the "selects" tab.
>>>>>>>> --
>>>>>>>> David Mitchell
>>>>>>>>
>>>>>>>> Matthew Brand wrote:
>>>>>>>>> Is there a library of "widgets" or does anybody have any code that can
>>>>>>>>> display some kind of progress bar.
>>>>>>>>> E.g.
>>>>>>>>>
>>>>>>>>> init_progressBar_ 10 NB. there will be 10 steps to 100% completion
>>>>>>>>>
>>>>>>>>> for_i i.10 do.
>>>>>>>>>   NB. do calculation step here...
>>>>>>>>>   update_progressBar_ i NB. alter progress bar to position i
>>>>>>>>> end.
>>>>>>>>>
>>>>>>>>> end_progressBar_ '' NB. stop displaying the progress bar.
>>>>>>>>>
>>>>>>>>> Just thought I would ask if this already exists before trying to write
>>>>>>>>> something to do it.
>>>>>>>>> ----------------------------------------------------------------------
>>>>>>>>> For information about J forums see
>>>>> http://www.jsoftware.com/forums.htm
>>>>>>>> ----------------------------------------------------------------------
>>>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>> ----------------------------------------------------------------------
>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>> ----------------------------------------------------------------------
>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by Matthew Brand-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What does wd 'setupdate id' actually do? It does not appear to update
the contents of the window. Is that something to do with using Java
(noop)? I run J using command the jwd.

"setupdate id ; Update window immediately. Noop in Java."
http://www.jsoftware.com/help/user/wd_commands.htm


2009/11/11 Matthew Brand <mtthwbrnd@...>:

> I've got another problem now. The window does not update while my
> program is running :-(. So the progress bar does not progress.
>
> Is there a command that can be issued to tell the window to redraw?
>
>
> Thanks,
> Matthew.
>
> 2009/11/11 Matthew Brand <mtthwbrnd@...>:
>> I have come up with this to allow multiple progress bars. I can't work
>> out how to make the close window button ( the cross) make the window
>> disappear and destroy the progress object.
>>
>> ------------------------------------
>> coclass 'progress'
>>
>> def =: 0 : 0
>> xywh 6 16 172 11;cc ccprogress progress ws_border;
>> xywh 6 3 173 10;cc info static;cn "";
>> pas 6 6;pcenter;
>> rem form end;
>> pshow
>> )
>>
>> create =: 3 : 0
>> 'wname start end' =: y
>> uname =: wname , > coname '' NB. unique name for wd
>> wd def ,~ 'pc ', uname, ';'
>> )
>>
>> destroy =: 3 : 0
>>        wd 'psel ', uname, '; pclose'
>>        codestroy ''
>> )
>>
>>
>> update =: 3 : 0
>> pos =. ": 100 <. <. 100 * (y - start) % end - start
>> wd 'psel ', uname,' ; set info ', pos,'; set ccprogress ', pos ,';'
>> )
>> --------------------------------------
>>
>> Example use:
>> load jpath , '~user/classes/progress.ijs'
>> p1 =. ('FirstBar';0;3) conew 'progress' NB. new progress bar scale 0 to 3
>> p2 =. ('SecondBar';0;9) conew 'progress' NB. new progress bar scale 0 to 9
>>
>> update__p1 0
>> update__p2 0
>> update__p1 1
>> update__p2 5
>> update__p1 2
>> update__p1 3
>> update__p2 9
>>
>> destroy__p1 ''
>> destroy__p2 ''
>>
>>
>>
>> 2009/11/11 David Mitchell <davidmitchell@...>:
>>> This guarantees that the correct parent form is active for subsequent commands.
>>>  If you have multiple forms in your script (or are debugging a new form using
>>> the J GUI, which has its own forms), the last form used is the active one.
>>>
>>> --
>>> David Mitchell
>>>
>>> Matthew Brand wrote:
>>>> Looks like you have to put the psel in the same call as the command
>>>> you want to send to the control:
>>>>
>>>> wd 0 : 0
>>>> psel proge;
>>>> set info 40
>>>> )
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> 2009/11/10 Don Guinn <donguinn@...>:
>>>>> I tried your foo1 and I couldn't get it to fail. I'm running VISTA. If you
>>>>> are running under Windows you might want to look at
>>>>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog as it
>>>>> gives you a way to interrupt a long running task.
>>>>>
>>>>> On Tue, Nov 10, 2009 at 6:35 AM, David Mitchell <davidmitchell@...>wrote:
>>>>>
>>>>>> psel is what I use:
>>>>>>
>>>>>>    foo1=: 3 : 0
>>>>>> wd 'psel proge'
>>>>>> wd 'set info ',": y
>>>>>> wd 'set ccprogress ',": y
>>>>>> )
>>>>>>
>>>>>> --
>>>>>> David Mitchell
>>>>>>
>>>>>> Matthew Brand wrote:
>>>>>>> "I am trying to understand how it works so I wrote this" ... well
>>>>>>> actually I mainly copy/pasted it from pASepProgressBar :-).
>>>>>>>
>>>>>>> 2009/11/10 Matthew Brand <mtthwbrnd@...>:
>>>>>>>> I can't get the pASepProgressBar class to work.
>>>>>>>> I am trying to understand how it works so I wrote this:
>>>>>>>> wd 0 : 0
>>>>>>>> pc proge;
>>>>>>>> xywh 6 16 172 11;cc ccprogress progress ws_border;
>>>>>>>> xywh 6 3 173 10;cc info static;cn "";
>>>>>>>> pas 6 6;pcenter;
>>>>>>>> rem form end;
>>>>>>>> pshow;
>>>>>>>> set info 50
>>>>>>>> )
>>>>>>>> wd 'set info 40'
>>>>>>>> If I highlight it all and press ctrl-R then it works as expected with
>>>>>> the
>>>>>>>> info label set to 40.
>>>>>>>> But if I try to run  wd 'set info 40' after that, I get an error:
>>>>>>>>    wd 'set info 40'
>>>>>>>> |domain error: wd
>>>>>>>> |       wd'set info 40'
>>>>>>>> |[-0]
>>>>>>>>    wd 'qer'
>>>>>>>> bad id : 0
>>>>>>>> How do I tell the wd command that I am referring to the info control
>>>>>> inside
>>>>>>>> the window (parent?)  proge?
>>>>>>>> What should I write instead of:
>>>>>>>>    wd 'set info 40'
>>>>>>>> Thanks,
>>>>>>>> Matthew.
>>>>>>>>
>>>>>>>> 2009/10/11 David Mitchell <davidmitchell@...>
>>>>>>>>> For Windows, there is this:
>>>>>>>>>
>>>>>>>>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog
>>>>>>>>>
>>>>>>>>> or the WD object progressbar:
>>>>>>>>>
>>>>>>>>> http://www.jsoftware.com/help/user/wd_commands.htm
>>>>>>>>>
>>>>>>>>> You can see the WD progress bar in action in the "controls" demo on the
>>>>>>>>> bottom
>>>>>>>>> of the "selects" tab.
>>>>>>>>> --
>>>>>>>>> David Mitchell
>>>>>>>>>
>>>>>>>>> Matthew Brand wrote:
>>>>>>>>>> Is there a library of "widgets" or does anybody have any code that can
>>>>>>>>>> display some kind of progress bar.
>>>>>>>>>> E.g.
>>>>>>>>>>
>>>>>>>>>> init_progressBar_ 10 NB. there will be 10 steps to 100% completion
>>>>>>>>>>
>>>>>>>>>> for_i i.10 do.
>>>>>>>>>>   NB. do calculation step here...
>>>>>>>>>>   update_progressBar_ i NB. alter progress bar to position i
>>>>>>>>>> end.
>>>>>>>>>>
>>>>>>>>>> end_progressBar_ '' NB. stop displaying the progress bar.
>>>>>>>>>>
>>>>>>>>>> Just thought I would ask if this already exists before trying to write
>>>>>>>>>> something to do it.
>>>>>>>>>> ----------------------------------------------------------------------
>>>>>>>>>> For information about J forums see
>>>>>> http://www.jsoftware.com/forums.htm
>>>>>>>>> ----------------------------------------------------------------------
>>>>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>>> ----------------------------------------------------------------------
>>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>> ----------------------------------------------------------------------
>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>>
>>>>> ----------------------------------------------------------------------
>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by David Mitchell-13 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You may find this helpful:

http://www.jsoftware.com/jwiki/Guides/Asynchronous GUI

--
David Mitchell

Matthew Brand wrote:

> What does wd 'setupdate id' actually do? It does not appear to update
> the contents of the window. Is that something to do with using Java
> (noop)? I run J using command the jwd.
>
> "setupdate id ; Update window immediately. Noop in Java."
> http://www.jsoftware.com/help/user/wd_commands.htm
>
>
> 2009/11/11 Matthew Brand <mtthwbrnd@...>:
>> I've got another problem now. The window does not update while my
>> program is running :-(. So the progress bar does not progress.
>>
>> Is there a command that can be issued to tell the window to redraw?
>>
>>
>> Thanks,
>> Matthew.
>>
>> 2009/11/11 Matthew Brand <mtthwbrnd@...>:
>>> I have come up with this to allow multiple progress bars. I can't work
>>> out how to make the close window button ( the cross) make the window
>>> disappear and destroy the progress object.
>>>
>>> ------------------------------------
>>> coclass 'progress'
>>>
>>> def =: 0 : 0
>>> xywh 6 16 172 11;cc ccprogress progress ws_border;
>>> xywh 6 3 173 10;cc info static;cn "";
>>> pas 6 6;pcenter;
>>> rem form end;
>>> pshow
>>> )
>>>
>>> create =: 3 : 0
>>> 'wname start end' =: y
>>> uname =: wname , > coname '' NB. unique name for wd
>>> wd def ,~ 'pc ', uname, ';'
>>> )
>>>
>>> destroy =: 3 : 0
>>>        wd 'psel ', uname, '; pclose'
>>>        codestroy ''
>>> )
>>>
>>>
>>> update =: 3 : 0
>>> pos =. ": 100 <. <. 100 * (y - start) % end - start
>>> wd 'psel ', uname,' ; set info ', pos,'; set ccprogress ', pos ,';'
>>> )
>>> --------------------------------------
>>>
>>> Example use:
>>> load jpath , '~user/classes/progress.ijs'
>>> p1 =. ('FirstBar';0;3) conew 'progress' NB. new progress bar scale 0 to 3
>>> p2 =. ('SecondBar';0;9) conew 'progress' NB. new progress bar scale 0 to 9
>>>
>>> update__p1 0
>>> update__p2 0
>>> update__p1 1
>>> update__p2 5
>>> update__p1 2
>>> update__p1 3
>>> update__p2 9
>>>
>>> destroy__p1 ''
>>> destroy__p2 ''
>>>
>>>
>>>
>>> 2009/11/11 David Mitchell <davidmitchell@...>:
>>>> This guarantees that the correct parent form is active for subsequent commands.
>>>>  If you have multiple forms in your script (or are debugging a new form using
>>>> the J GUI, which has its own forms), the last form used is the active one.
>>>>
>>>> --
>>>> David Mitchell
>>>>
>>>> Matthew Brand wrote:
>>>>> Looks like you have to put the psel in the same call as the command
>>>>> you want to send to the control:
>>>>>
>>>>> wd 0 : 0
>>>>> psel proge;
>>>>> set info 40
>>>>> )
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 2009/11/10 Don Guinn <donguinn@...>:
>>>>>> I tried your foo1 and I couldn't get it to fail. I'm running VISTA. If you
>>>>>> are running under Windows you might want to look at
>>>>>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog as it
>>>>>> gives you a way to interrupt a long running task.
>>>>>>
>>>>>> On Tue, Nov 10, 2009 at 6:35 AM, David Mitchell <davidmitchell@...>wrote:
>>>>>>
>>>>>>> psel is what I use:
>>>>>>>
>>>>>>>    foo1=: 3 : 0
>>>>>>> wd 'psel proge'
>>>>>>> wd 'set info ',": y
>>>>>>> wd 'set ccprogress ',": y
>>>>>>> )
>>>>>>>
>>>>>>> --
>>>>>>> David Mitchell
>>>>>>>
>>>>>>> Matthew Brand wrote:
>>>>>>>> "I am trying to understand how it works so I wrote this" ... well
>>>>>>>> actually I mainly copy/pasted it from pASepProgressBar :-).
>>>>>>>>
>>>>>>>> 2009/11/10 Matthew Brand <mtthwbrnd@...>:
>>>>>>>>> I can't get the pASepProgressBar class to work.
>>>>>>>>> I am trying to understand how it works so I wrote this:
>>>>>>>>> wd 0 : 0
>>>>>>>>> pc proge;
>>>>>>>>> xywh 6 16 172 11;cc ccprogress progress ws_border;
>>>>>>>>> xywh 6 3 173 10;cc info static;cn "";
>>>>>>>>> pas 6 6;pcenter;
>>>>>>>>> rem form end;
>>>>>>>>> pshow;
>>>>>>>>> set info 50
>>>>>>>>> )
>>>>>>>>> wd 'set info 40'
>>>>>>>>> If I highlight it all and press ctrl-R then it works as expected with
>>>>>>> the
>>>>>>>>> info label set to 40.
>>>>>>>>> But if I try to run  wd 'set info 40' after that, I get an error:
>>>>>>>>>    wd 'set info 40'
>>>>>>>>> |domain error: wd
>>>>>>>>> |       wd'set info 40'
>>>>>>>>> |[-0]
>>>>>>>>>    wd 'qer'
>>>>>>>>> bad id : 0
>>>>>>>>> How do I tell the wd command that I am referring to the info control
>>>>>>> inside
>>>>>>>>> the window (parent?)  proge?
>>>>>>>>> What should I write instead of:
>>>>>>>>>    wd 'set info 40'
>>>>>>>>> Thanks,
>>>>>>>>> Matthew.
>>>>>>>>>
>>>>>>>>> 2009/10/11 David Mitchell <davidmitchell@...>
>>>>>>>>>> For Windows, there is this:
>>>>>>>>>>
>>>>>>>>>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog
>>>>>>>>>>
>>>>>>>>>> or the WD object progressbar:
>>>>>>>>>>
>>>>>>>>>> http://www.jsoftware.com/help/user/wd_commands.htm
>>>>>>>>>>
>>>>>>>>>> You can see the WD progress bar in action in the "controls" demo on the
>>>>>>>>>> bottom
>>>>>>>>>> of the "selects" tab.
>>>>>>>>>> --
>>>>>>>>>> David Mitchell
>>>>>>>>>>
>>>>>>>>>> Matthew Brand wrote:
>>>>>>>>>>> Is there a library of "widgets" or does anybody have any code that can
>>>>>>>>>>> display some kind of progress bar.
>>>>>>>>>>> E.g.
>>>>>>>>>>>
>>>>>>>>>>> init_progressBar_ 10 NB. there will be 10 steps to 100% completion
>>>>>>>>>>>
>>>>>>>>>>> for_i i.10 do.
>>>>>>>>>>>   NB. do calculation step here...
>>>>>>>>>>>   update_progressBar_ i NB. alter progress bar to position i
>>>>>>>>>>> end.
>>>>>>>>>>>
>>>>>>>>>>> end_progressBar_ '' NB. stop displaying the progress bar.
>>>>>>>>>>>
>>>>>>>>>>> Just thought I would ask if this already exists before trying to write
>>>>>>>>>>> something to do it.
>>>>>>>>>>> ----------------------------------------------------------------------
>>>>>>>>>>> For information about J forums see
>>>>>>> http://www.jsoftware.com/forums.htm
>>>>>>>>>> ----------------------------------------------------------------------
>>>>>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>>>> ----------------------------------------------------------------------
>>>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>>> ----------------------------------------------------------------------
>>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>>>
>>>>>> ----------------------------------------------------------------------
>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>>
>>>>> ----------------------------------------------------------------------
>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by Matthew Brand-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks. Version below is much better. It updates every 1% of the task
that is completed.

----------------------

coclass 'progress'

def =: 0 : 0
xywh 6 16 172 11;cc ccprogress progress ws_border;
xywh 6 3 173 10;cc info static;cn "";
pas 6 6;pcenter;
rem form end;
pshow
)

create =: 3 : 0
'wname start end' =: y
uname =: wname , > coname '' NB. unique name for wd
wd def ,~ 'pc ', uname, ';'
)

destroy =: 3 : 0
     wd 'psel ', uname, '; pclose'
     codestroy ''
)

last =: 0
update =: 3 : 0
pos =. 100 <. 100 * (y - start) % end - start
if. pos > last do.
last =: last + 1
infoPos =. '%' ,~ ": <. pos
progPos =. ": <. pos
wd 'psel ', uname,' ; set info ', infoPos,'; set ccprogress ', progPos ,';'
wd 'psel ', uname,'; msgs'
end.
)
----------------------

Example:

load jpath , '~user/classes/progress.ijs'

test =: 3 : 0
p =. ('Example';0;y) conew 'progress'
for_i. i. y do.
update__p i
end.
destroy__p ''
)

test 100000

2009/11/11 David Mitchell <davidmitchell@...>:

> You may find this helpful:
>
> http://www.jsoftware.com/jwiki/Guides/Asynchronous GUI
>
> --
> David Mitchell
>
> Matthew Brand wrote:
>> What does wd 'setupdate id' actually do? It does not appear to update
>> the contents of the window. Is that something to do with using Java
>> (noop)? I run J using command the jwd.
>>
>> "setupdate id ; Update window immediately. Noop in Java."
>> http://www.jsoftware.com/help/user/wd_commands.htm
>>
>>
>> 2009/11/11 Matthew Brand <mtthwbrnd@...>:
>>> I've got another problem now. The window does not update while my
>>> program is running :-(. So the progress bar does not progress.
>>>
>>> Is there a command that can be issued to tell the window to redraw?
>>>
>>>
>>> Thanks,
>>> Matthew.
>>>
>>> 2009/11/11 Matthew Brand <mtthwbrnd@...>:
>>>> I have come up with this to allow multiple progress bars. I can't work
>>>> out how to make the close window button ( the cross) make the window
>>>> disappear and destroy the progress object.
>>>>
>>>> ------------------------------------
>>>> coclass 'progress'
>>>>
>>>> def =: 0 : 0
>>>> xywh 6 16 172 11;cc ccprogress progress ws_border;
>>>> xywh 6 3 173 10;cc info static;cn "";
>>>> pas 6 6;pcenter;
>>>> rem form end;
>>>> pshow
>>>> )
>>>>
>>>> create =: 3 : 0
>>>> 'wname start end' =: y
>>>> uname =: wname , > coname '' NB. unique name for wd
>>>> wd def ,~ 'pc ', uname, ';'
>>>> )
>>>>
>>>> destroy =: 3 : 0
>>>>        wd 'psel ', uname, '; pclose'
>>>>        codestroy ''
>>>> )
>>>>
>>>>
>>>> update =: 3 : 0
>>>> pos =. ": 100 <. <. 100 * (y - start) % end - start
>>>> wd 'psel ', uname,' ; set info ', pos,'; set ccprogress ', pos ,';'
>>>> )
>>>> --------------------------------------
>>>>
>>>> Example use:
>>>> load jpath , '~user/classes/progress.ijs'
>>>> p1 =. ('FirstBar';0;3) conew 'progress' NB. new progress bar scale 0 to 3
>>>> p2 =. ('SecondBar';0;9) conew 'progress' NB. new progress bar scale 0 to 9
>>>>
>>>> update__p1 0
>>>> update__p2 0
>>>> update__p1 1
>>>> update__p2 5
>>>> update__p1 2
>>>> update__p1 3
>>>> update__p2 9
>>>>
>>>> destroy__p1 ''
>>>> destroy__p2 ''
>>>>
>>>>
>>>>
>>>> 2009/11/11 David Mitchell <davidmitchell@...>:
>>>>> This guarantees that the correct parent form is active for subsequent commands.
>>>>>  If you have multiple forms in your script (or are debugging a new form using
>>>>> the J GUI, which has its own forms), the last form used is the active one.
>>>>>
>>>>> --
>>>>> David Mitchell
>>>>>
>>>>> Matthew Brand wrote:
>>>>>> Looks like you have to put the psel in the same call as the command
>>>>>> you want to send to the control:
>>>>>>
>>>>>> wd 0 : 0
>>>>>> psel proge;
>>>>>> set info 40
>>>>>> )
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> 2009/11/10 Don Guinn <donguinn@...>:
>>>>>>> I tried your foo1 and I couldn't get it to fail. I'm running VISTA. If you
>>>>>>> are running under Windows you might want to look at
>>>>>>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog as it
>>>>>>> gives you a way to interrupt a long running task.
>>>>>>>
>>>>>>> On Tue, Nov 10, 2009 at 6:35 AM, David Mitchell <davidmitchell@...>wrote:
>>>>>>>
>>>>>>>> psel is what I use:
>>>>>>>>
>>>>>>>>    foo1=: 3 : 0
>>>>>>>> wd 'psel proge'
>>>>>>>> wd 'set info ',": y
>>>>>>>> wd 'set ccprogress ',": y
>>>>>>>> )
>>>>>>>>
>>>>>>>> --
>>>>>>>> David Mitchell
>>>>>>>>
>>>>>>>> Matthew Brand wrote:
>>>>>>>>> "I am trying to understand how it works so I wrote this" ... well
>>>>>>>>> actually I mainly copy/pasted it from pASepProgressBar :-).
>>>>>>>>>
>>>>>>>>> 2009/11/10 Matthew Brand <mtthwbrnd@...>:
>>>>>>>>>> I can't get the pASepProgressBar class to work.
>>>>>>>>>> I am trying to understand how it works so I wrote this:
>>>>>>>>>> wd 0 : 0
>>>>>>>>>> pc proge;
>>>>>>>>>> xywh 6 16 172 11;cc ccprogress progress ws_border;
>>>>>>>>>> xywh 6 3 173 10;cc info static;cn "";
>>>>>>>>>> pas 6 6;pcenter;
>>>>>>>>>> rem form end;
>>>>>>>>>> pshow;
>>>>>>>>>> set info 50
>>>>>>>>>> )
>>>>>>>>>> wd 'set info 40'
>>>>>>>>>> If I highlight it all and press ctrl-R then it works as expected with
>>>>>>>> the
>>>>>>>>>> info label set to 40.
>>>>>>>>>> But if I try to run  wd 'set info 40' after that, I get an error:
>>>>>>>>>>    wd 'set info 40'
>>>>>>>>>> |domain error: wd
>>>>>>>>>> |       wd'set info 40'
>>>>>>>>>> |[-0]
>>>>>>>>>>    wd 'qer'
>>>>>>>>>> bad id : 0
>>>>>>>>>> How do I tell the wd command that I am referring to the info control
>>>>>>>> inside
>>>>>>>>>> the window (parent?)  proge?
>>>>>>>>>> What should I write instead of:
>>>>>>>>>>    wd 'set info 40'
>>>>>>>>>> Thanks,
>>>>>>>>>> Matthew.
>>>>>>>>>>
>>>>>>>>>> 2009/10/11 David Mitchell <davidmitchell@...>
>>>>>>>>>>> For Windows, there is this:
>>>>>>>>>>>
>>>>>>>>>>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog
>>>>>>>>>>>
>>>>>>>>>>> or the WD object progressbar:
>>>>>>>>>>>
>>>>>>>>>>> http://www.jsoftware.com/help/user/wd_commands.htm
>>>>>>>>>>>
>>>>>>>>>>> You can see the WD progress bar in action in the "controls" demo on the
>>>>>>>>>>> bottom
>>>>>>>>>>> of the "selects" tab.
>>>>>>>>>>> --
>>>>>>>>>>> David Mitchell
>>>>>>>>>>>
>>>>>>>>>>> Matthew Brand wrote:
>>>>>>>>>>>> Is there a library of "widgets" or does anybody have any code that can
>>>>>>>>>>>> display some kind of progress bar.
>>>>>>>>>>>> E.g.
>>>>>>>>>>>>
>>>>>>>>>>>> init_progressBar_ 10 NB. there will be 10 steps to 100% completion
>>>>>>>>>>>>
>>>>>>>>>>>> for_i i.10 do.
>>>>>>>>>>>>   NB. do calculation step here...
>>>>>>>>>>>>   update_progressBar_ i NB. alter progress bar to position i
>>>>>>>>>>>> end.
>>>>>>>>>>>>
>>>>>>>>>>>> end_progressBar_ '' NB. stop displaying the progress bar.
>>>>>>>>>>>>
>>>>>>>>>>>> Just thought I would ask if this already exists before trying to write
>>>>>>>>>>>> something to do it.
>>>>>>>>>>>> ----------------------------------------------------------------------
>>>>>>>>>>>> For information about J forums see
>>>>>>>> http://www.jsoftware.com/forums.htm
>>>>>>>>>>> ----------------------------------------------------------------------
>>>>>>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>>>>> ----------------------------------------------------------------------
>>>>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>>>> ----------------------------------------------------------------------
>>>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>>>>
>>>>>>> ----------------------------------------------------------------------
>>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>>>
>>>>>> ----------------------------------------------------------------------
>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>> ----------------------------------------------------------------------
>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Re: progress bar

by Oleg Kobchenko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

To be precise, the form that generated THE event,
or if the form was just created, it is that form.
The same for an isigraph control.



----- Original Message ----

> From: David Mitchell <davidmitchell@...>
>
> This guarantees that the correct parent form is active for subsequent commands.
>   If you have multiple forms in your script (or are debugging a new form using
> the J GUI, which has its own forms), the last form used is the active one.
>
> --
> David Mitchell
>
> Matthew Brand wrote:
> > Looks like you have to put the psel in the same call as the command
> > you want to send to the control:
> >
> > wd 0 : 0
> > psel proge;
> > set info 40
> > )
> >
> >
> >
> >
> >
> > 2009/11/10 Don Guinn :
> >> I tried your foo1 and I couldn't get it to fail. I'm running VISTA. If you
> >> are running under Windows you might want to look at
> >> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog as it
> >> gives you a way to interrupt a long running task.
> >>
> >> On Tue, Nov 10, 2009 at 6:35 AM, David Mitchell wrote:
> >>
> >>> psel is what I use:
> >>>
> >>>    foo1=: 3 : 0
> >>> wd 'psel proge'
> >>> wd 'set info ',": y
> >>> wd 'set ccprogress ',": y
> >>> )
> >>>
> >>> --
> >>> David Mitchell
> >>>
> >>> Matthew Brand wrote:
> >>>> "I am trying to understand how it works so I wrote this" ... well
> >>>> actually I mainly copy/pasted it from pASepProgressBar :-).
> >>>>
> >>>> 2009/11/10 Matthew Brand :
> >>>>> I can't get the pASepProgressBar class to work.
> >>>>> I am trying to understand how it works so I wrote this:
> >>>>> wd 0 : 0
> >>>>> pc proge;
> >>>>> xywh 6 16 172 11;cc ccprogress progress ws_border;
> >>>>> xywh 6 3 173 10;cc info static;cn "";
> >>>>> pas 6 6;pcenter;
> >>>>> rem form end;
> >>>>> pshow;
> >>>>> set info 50
> >>>>> )
> >>>>> wd 'set info 40'
> >>>>> If I highlight it all and press ctrl-R then it works as expected with
> >>> the
> >>>>> info label set to 40.
> >>>>> But if I try to run  wd 'set info 40' after that, I get an error:
> >>>>>    wd 'set info 40'
> >>>>> |domain error: wd
> >>>>> |       wd'set info 40'
> >>>>> |[-0]
> >>>>>    wd 'qer'
> >>>>> bad id : 0
> >>>>> How do I tell the wd command that I am referring to the info control
> >>> inside
> >>>>> the window (parent?)  proge?
> >>>>> What should I write instead of:
> >>>>>    wd 'set info 40'
> >>>>> Thanks,
> >>>>> Matthew.
> >>>>>
> >>>>> 2009/10/11 David Mitchell
> >>>>>> For Windows, there is this:
> >>>>>>
> >>>>>> http://www.jsoftware.com/jwiki/Guides/Windows%20Progress%20Dialog
> >>>>>>
> >>>>>> or the WD object progressbar:
> >>>>>>
> >>>>>> http://www.jsoftware.com/help/user/wd_commands.htm
> >>>>>>
> >>>>>> You can see the WD progress bar in action in the "controls" demo on the
> >>>>>> bottom
> >>>>>> of the "selects" tab.
> >>>>>> --
> >>>>>> David Mitchell
> >>>>>>
> >>>>>> Matthew Brand wrote:
> >>>>>>> Is there a library of "widgets" or does anybody have any code that can
> >>>>>>> display some kind of progress bar.
> >>>>>>> E.g.
> >>>>>>>
> >>>>>>> init_progressBar_ 10 NB. there will be 10 steps to 100% completion
> >>>>>>>
> >>>>>>> for_i i.10 do.
> >>>>>>>   NB. do calculation step here...
> >>>>>>>   update_progressBar_ i NB. alter progress bar to position i
> >>>>>>> end.
> >>>>>>>
> >>>>>>> end_progressBar_ '' NB. stop displaying the progress bar.
> >>>>>>>
> >>>>>>> Just thought I would ask if this already exists before trying to write
> >>>>>>> something to do it.
> >>>>>>> ----------------------------------------------------------------------
> >>>>>>> For information about J forums see
> >>> http://www.jsoftware.com/forums.htm
> >>>>>> ----------------------------------------------------------------------
> >>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>>> ----------------------------------------------------------------------
> >>>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>> ----------------------------------------------------------------------
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> >>>
> >> ----------------------------------------------------------------------
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >>
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



     
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm