time delay within a loop

Learning APL or new to Dyalog? Ask "silly" questions here, without fear...

Re: time delay within a loop

Postby Vince|Dyalog on Fri May 06, 2016 8:06 am

Hi Stu,

You can just add the Style property:

      IB←'Button' ' ? '(90 17)('Event' 'Select' 'RAND')('style' 'check')
'APP.IR'⎕WC IB


Regards,

Vince
Vince|Dyalog
 
Posts: 412
Joined: Wed Oct 01, 2008 9:39 am

Re: time delay within a loop

Postby Stu on Fri May 06, 2016 3:21 pm

Thanks! That's exactly what I wanted.

-Stu
Stu
 
Posts: 97
Joined: Thu Dec 31, 2015 1:30 am

Re: time delay within a loop

Postby Stu on Fri May 06, 2016 11:03 pm

The "xshapes" GUI I included in my May 4 post works fine; however, I can't start it up without the session window also starting up. I've tried ⎕LX←'⎕DQ''.''' and ⎕LX←'⎕DQ''#''', but these don't prevent the session window from appearing. What am I not doing, or doing wrong?
Stu
 
Posts: 97
Joined: Thu Dec 31, 2015 1:30 am

Re: time delay within a loop

Postby DanB|Dyalog on Sun May 08, 2016 2:33 pm

If you don't want the session to appear you can use the runtime interpreter, dyalogrt.exe.
Be warned though that errors cannot be dealt with as there is no session!
DanB|Dyalog
 

Re: time delay within a loop

Postby Stu on Sun May 08, 2016 8:30 pm

If I wanted to share one of my workspaces with other APL users, would it be better to just forget about ⎕LX←'⎕DQ''.''' and ⎕LX←'⎕DQ''#''' and the runtime interpreter? Other users could just minimize the session window themselves if they didn't want it, or they could leave the session window open to see my code if they wanted to do that.
Stu
 
Posts: 97
Joined: Thu Dec 31, 2015 1:30 am

Re: time delay within a loop

Postby AndyS|Dyalog on Mon May 09, 2016 11:40 am

Hi Stu

I think that the State property of ⎕se will help ..

Where ever possible I always define a function called "lx" and then set
      ⎕lx←'lx'
rather than setting up a complex ⎕lx expression: it's easier to amend the function, and allows me to extend what happens when the workspace is loaded. Sticking with the same name makes it easier for me and others to work out what the workspace does !

So I would have something like
      ∇lx
⎕se.⎕ws'State' 1
'f'⎕wc'Form'
⎕dq'f'

⎕lx←'lx'


I'd also be very careful about using ⎕OFF to terminate the application .. it is so easy to call ⎕off _before_ remembering to save your work .. I'd rather not think about how many times I've done that ! So if you are going to call ⎕off to terminate the application, I would be inclined to write a cover function which prompts you before terminating the APL process.
User avatar
AndyS|Dyalog
 
Posts: 257
Joined: Tue May 12, 2009 6:06 pm

Re: time delay within a loop

Postby PGilbert on Mon May 09, 2016 12:13 pm

In case this is helping, you can use the following to 'Show' and 'Hide' the session:

Code: Select all
 HideSession;handle;ShowWindow
 handle ← '⎕SE' ⎕WG 'handle'
 ⎕NA 'I4 user32 | ShowWindow P I4'
 {}ShowWindow handle 0


Code: Select all
 ShowSession;handle;ShowWindow
 handle ← '⎕SE' ⎕WG 'handle'
 ⎕NA'I4 user32 | ShowWindow P I4'
 {}ShowWindow handle 1
User avatar
PGilbert
 
Posts: 436
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: time delay within a loop

Postby Stu on Mon May 09, 2016 10:14 pm

Hi Andy,

I don't know how to use the piece of code you suggested:

∇lx
⎕se.⎕ws'State' 1
'f'⎕wc'Form'
⎕dq'f'


It creates an empty form that I have to close before I can use the little GUI I built for my application. Could you briefly explain how this works?

Thanks!

-Stu
Stu
 
Posts: 97
Joined: Thu Dec 31, 2015 1:30 am

Re: time delay within a loop

Postby AndyS|Dyalog on Wed May 18, 2016 3:17 pm

Stu

I may have been rather opaque in my post .. sorry !

My code snippet was to show how you might write a very simple application which runs with a minimised session, waits for some input (in this case, for you to close the form) and then terminates - in production I would have a ⎕OFF as the last line of the function (actually, I would have ⎕off 10 (see more inthis forums post)). So for your applicaton you should replace the two lines
      'f'⎕wc'Form'
⎕dq'f'
with a call to your application.
User avatar
AndyS|Dyalog
 
Posts: 257
Joined: Tue May 12, 2009 6:06 pm

Re: time delay within a loop

Postby Stu on Wed May 18, 2016 3:40 pm

Problem solved!

Thanks.

-Stu
Stu
 
Posts: 97
Joined: Thu Dec 31, 2015 1:30 am

Previous

Return to New to Dyalog?

Who is online

Users browsing this forum: No registered users and 1 guest