Source language: Translate to:

Flashing cursor/egg timer

General questions about NeoBook

Moderator: Neosoft Support

Flashing cursor/egg timer

Postby DaveJ » Mon Jun 09, 2014 3:59 am

Hi not sure where to put this but someone else may have had the same problem.
When Neobook is running a loop with many commands, the cursor rapidly flashes between a pointer and the computer busy cursor.
Basically I search a database for a date required field and check if the date has passed, is within 7 days or is greater than 7 days.
The results are then written into a html table which I display. This is set to update every minute but every time it updates the cursor flashes rapidly as the loop is executed, which is a bit annoying.
Is there any way of avoiding this?

Thanks

Dave J

Here is the code if anyone is interested.
*****Subroutine*******
dbpQuery "mydb" "job" "status=[#34]open[#34] AND DateRequired <> [#34][#34]"
dbpSort "mydb" "job" "DateRequired=ASC"
SetVar "[Table_Line]" "<html>[#13]<body bgcolor=[#34]#000000[#34]>[#13]<head>[#13]<meta http-equiv=[#34]Content-Language[#34] content=[#34]en-gb[#34]>[#13]<meta http-equiv=[#34]Content-Type[#34] content=[#34]text/html; charset=windows-1252[#34]>[#13]<title>mydb Jobs</title>[#13][#13]</head>[#13]<body>[#13]<table border=[#34]1[#34] width=[#34]100%[#34] cellspacing=[#34]1[#34] bordercolor=[#34]#000000[#34]>"
FileWrite "[PubDir]table1.html" "All" "[Table_Line]"
Loop "1" "14" "[job_loop_pos]"
If "[mydb.job.$RecCount]" ">=" "[job_loop_pos]"
dbpGotoRecord "mydb" "job" "[job_loop_pos]"
SetVar "[job[job_loop_pos]]" "[mydb.job.job_no]"
SetVar "[Required[job_loop_pos]]" "![mydb.job.DateRequired]"
SetVar "[customer[job_loop_pos]]" "[mydb.job.Site_name]"

dbpQuery "mydb" "products" "job_no = [#34][mydb.job.job_no][#34]"
If "[mydb.products.$RecCount]" "=" "0"
SetVar "[DisplayProductLoop]" "1"
Else
SetVar "[DisplayProductLoop]" "[mydb.products.$RecCount]"

EndIf
Loop "1" "[DisplayProductLoop]" "[WorkLoop]"
Setvar "[WorkRequired[job_loop_pos]]" "[mydb.products.other_info]"
SetVar "[product[job_loop_pos]]" "[mydb.products.model]"
.Convert Job Required date to Julian format
StrParse "[mydb.job.DateRequired]" "/" "[WD_date]" "[null]"
.reverse date format
SetVar "[RtInputVar1]" "[WD_date3][WD_date2][WD_date1]"
rtDate2Julian
SetVar "[JobDate_Julian]" "[RtResult]"
.Convert Todays date to Julian format
rtTodayAs_YYYYMMDD
SetVar "[RtInputVar1]" "[RtResult]"
rtDate2Julian
SetVar "[TodayDate_Julian]" "[RtResult]"

.If the Job date is smaller than todays date it is late and so we write the html line with the following parameters

Setvar "[TodayDate_Julian_minus7]" "[TodayDate_Julian]-7"
If "[jobdate_julian]" ">" "[TodayDate_Julian_minus7]"
SetVar "[Table_Line]" "<tr>[#13]<td bgcolor=[#34]#FFC400[#34] width=[#34]10%[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[job[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFC400[#34] width=[#34]327[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[customer[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFC400[#34] width=[#34]340[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[product[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFC400[#34] width=[#34]352[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[WorkRequired[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFC400[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[Required[job_loop_pos]]</font></td>[#13]</tr>[#13]"
EndIf

If "[JobDate_Julian]" "<=" "[TodayDate_Julian]"
SetVar "[Table_Line]" "<tr>[#13]<td bgcolor=[#34]#FF4000[#34] width=[#34]10%[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[job[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FF4000[#34] width=[#34]327[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[customer[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FF4000[#34] width=[#34]340[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[product[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FF4000[#34] width=[#34]352[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[WorkRequired[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FF4000[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[Required[job_loop_pos]]</font></td>[#13]</tr>[#13]"
EndIf
Setvar "[TodayDate_Julian_plus7]" "[TodayDate_Julian]+7"
If "[JobDate_Julian]" ">" "[TodayDate_Julian_plus7]"
SetVar "[Table_Line]" "<tr>[#13]<td bgcolor=[#34]#FFFFFF[#34] width=[#34]10%[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[job[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFFFFF[#34] width=[#34]327[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[customer[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFFFFF[#34] width=[#34]340[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[product[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFFFFF[#34] width=[#34]352[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[WorkRequired[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFFFFF[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[Required[job_loop_pos]]</font></td>[#13]</tr>[#13]"
Endif
FileWrite "[PubDir]table1.html" "Append" "[Table_Line]"
SetVar "[Table_Line]" ""
EndIf
dbpNext "mydb" "products"
EndLoop
EndLoop
SetVar "[Table_Line]" "</table>[#13][#13]</body>[#13][#13]</html>"
FileWrite "[PubDir]table1.html" "Append" "[Table_Line]"
RefreshObject "WebBrowser2"
TimerStart "Timer4" "60000"
ShowObject "WebBrowser2" "Wipe Down" "1"
Return
DaveJ
 
Posts: 90
Joined: Tue Dec 30, 2008 11:06 am

Re: Flashing cursor/egg timer

Postby Gaev » Mon Jun 09, 2014 6:26 am

DaveJ:

1) It is difficult to follow your code when you don't indent Loop/EndLoop and If/Else/Endif code blocks.

2) When I did it, I found that one of your EndIf and EndLoop commands are out of order ... see lines marked with $$$$ and **** ...
Code: Select all
dbpQuery "mydb" "job" "status=[#34]open[#34] AND DateRequired <> [#34][#34]"
dbpSort "mydb" "job" "DateRequired=ASC"
SetVar "[Table_Line]" "<html>[#13]<body bgcolor=[#34]#000000[#34]>[#13]<head>[#13]<meta http-equiv=[#34]Content-Language[#34] content=[#34]en-gb[#34]>[#13]<meta http-equiv=[#34]Content-Type[#34] content=[#34]text/html; charset=windows-1252[#34]>[#13]<title>mydb Jobs</title>[#13][#13]</head>[#13]<body>[#13]<table border=[#34]1[#34] width=[#34]100%[#34] cellspacing=[#34]1[#34] bordercolor=[#34]#000000[#34]>"
FileWrite "[PubDir]table1.html" "All" "[Table_Line]"
Loop "1" "14" "[job_loop_pos]"
   $$$$If "[mydb.job.$RecCount]" ">=" "[job_loop_pos]"
      dbpGotoRecord "mydb" "job" "[job_loop_pos]"
      SetVar "[job[job_loop_pos]]" "[mydb.job.job_no]"
      SetVar "[Required[job_loop_pos]]" "![mydb.job.DateRequired]"
      SetVar "[customer[job_loop_pos]]" "[mydb.job.Site_name]"

      dbpQuery "mydb" "products" "job_no = [#34][mydb.job.job_no][#34]"
      If "[mydb.products.$RecCount]" "=" "0"
         SetVar "[DisplayProductLoop]" "1"
      Else
         SetVar "[DisplayProductLoop]" "[mydb.products.$RecCount]"
      EndIf
****      Loop "1" "[DisplayProductLoop]" "[WorkLoop]"
         Setvar "[WorkRequired[job_loop_pos]]" "[mydb.products.other_info]"
         SetVar "[product[job_loop_pos]]" "[mydb.products.model]"
         .Convert Job Required date to Julian format
         StrParse "[mydb.job.DateRequired]" "/" "[WD_date]" "[null]"
         .reverse date format
         SetVar "[RtInputVar1]" "[WD_date3][WD_date2][WD_date1]"
         rtDate2Julian
         SetVar "[JobDate_Julian]" "[RtResult]"
         .Convert Todays date to Julian format
         rtTodayAs_YYYYMMDD
         SetVar "[RtInputVar1]" "[RtResult]"
         rtDate2Julian
         SetVar "[TodayDate_Julian]" "[RtResult]"

         .If the Job date is smaller than todays date it is late and so we write the html line with the following parameters
         Setvar "[TodayDate_Julian_minus7]" "[TodayDate_Julian]-7"
         If "[jobdate_julian]" ">" "[TodayDate_Julian_minus7]"
            SetVar "[Table_Line]" "<tr>[#13]<td bgcolor=[#34]#FFC400[#34] width=[#34]10%[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[job[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFC400[#34] width=[#34]327[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[customer[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFC400[#34] width=[#34]340[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[product[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFC400[#34] width=[#34]352[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[WorkRequired[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFC400[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[Required[job_loop_pos]]</font></td>[#13]</tr>[#13]"
         EndIf

         If "[JobDate_Julian]" "<=" "[TodayDate_Julian]"
            SetVar "[Table_Line]" "<tr>[#13]<td bgcolor=[#34]#FF4000[#34] width=[#34]10%[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[job[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FF4000[#34] width=[#34]327[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[customer[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FF4000[#34] width=[#34]340[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[product[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FF4000[#34] width=[#34]352[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[WorkRequired[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FF4000[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[Required[job_loop_pos]]</font></td>[#13]</tr>[#13]"
         EndIf

         Setvar "[TodayDate_Julian_plus7]" "[TodayDate_Julian]+7"
         If "[JobDate_Julian]" ">" "[TodayDate_Julian_plus7]"
            SetVar "[Table_Line]" "<tr>[#13]<td bgcolor=[#34]#FFFFFF[#34] width=[#34]10%[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[job[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFFFFF[#34] width=[#34]327[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[customer[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFFFFF[#34] width=[#34]340[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[product[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFFFFF[#34] width=[#34]352[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[WorkRequired[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFFFFF[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[Required[job_loop_pos]]</font></td>[#13]</tr>[#13]"
         Endif
         FileWrite "[PubDir]table1.html" "Append" "[Table_Line]"
         SetVar "[Table_Line]" ""
   $$$$EndIf
   dbpNext "mydb" "products"
****   EndLoop
EndLoop
SetVar "[Table_Line]" "</table>[#13][#13]</body>[#13][#13]</html>"
FileWrite "[PubDir]table1.html" "Append" "[Table_Line]"
RefreshObject "WebBrowser2"
TimerStart "Timer4" "60000"
ShowObject "WebBrowser2" "Wipe Down" "1"
Return
... so first, you have to fix this order (and decide where the dbpNext command should reside)

3) I am not sure why you are starting Timer4 inside the Timer subroutine ... I don't see a TimerStop command.

4) As for the blinking cursor ...

a) how long does the blinking last ?

b) I don't know of a command to hide the cursor ... but you might try and move it off-screen with ...

- a GetMousePos command (to save current position) at the start of the subroutine
- then use SetMousePos to a location outside the Screen (e.g. negative value or very large value)
- restore the original mouse position at the ned of the subroutine (to the previously saved location)

c) you might selectively comment out some of your database and file commands to see where exactly the egg timer is being displayed ... there might be an opportunity to reduce the blinking to just one (slightly longer) occurence e.g. by reading all required information or writing to the file in one shot
User avatar
Gaev
 
Posts: 3738
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Flashing cursor/egg timer

Postby dec » Mon Jun 09, 2014 7:14 am

Hello,

Gaev wrote:b) I don't know of a command to hide the cursor ... but you might try and move it off-screen with ...


Now you know at least one Gaev: npHideCursor. However, sometimes we can get this cursor behaviour in loops or code like that. The cursor is set to the "busy" one, and, if you move the cursor over some edit boxes, for example, for a quicktime the cursor change to this object default cursor, to change again to the "busy" one. I don't know if this is the case, but, if so, then probably we can't do nothing since this is the default behaviour.
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Flashing cursor/egg timer

Postby DaveJ » Mon Jun 09, 2014 7:26 am

Sorry guys, I don't know what happened to my indenting but here it is again readable with more comments.
Thanks Gaev I hadn't spotted the EndIf in the loop instead of after it.
Code: Select all
:WorkDisplay
.Check that the job has a status of 'open' and a required by date
dbpQuery "mydb" "job" "status=[#34]open[#34] AND DateRequired <> [#34][#34]"
.Sort in order of date
dbpSort "mydb" "job" "DateRequired=ASC"
.Create the html header for our table
SetVar "[Table_Line]" "<html>[#13]<body bgcolor=[#34]#000000[#34]>[#13]<head>[#13]<meta http-equiv=[#34]Content-Language[#34] content=[#34]en-gb[#34]>[#13]<meta http-equiv=[#34]Content-Type[#34] content=[#34]text/html; charset=windows-1252[#34]>[#13]<title>mydb Jobs</title>[#13][#13]</head>[#13]<body>[#13]<table border=[#34]1[#34] width=[#34]100%[#34] cellspacing=[#34]1[#34] bordercolor=[#34]#000000[#34]>"
FileWrite "[PubDir]table1.html" "All" "[Table_Line]"
.Create a loop to go through the jobs
Loop "1" "14" "[job_loop_pos]"
       If "[mydb.job.$RecCount]" ">=" "[job_loop_pos]"
           dbpGotoRecord "mydb" "job" "[job_loop_pos]"
           SetVar "[job[job_loop_pos]]" "[mydb.job.job_no]"
           SetVar "[Required[job_loop_pos]]" "![mydb.job.DateRequired]"
           SetVar "[customer[job_loop_pos]]" "[mydb.job.Site_name]"
           .Look up parts listed for job so that we can create a line entry for each part of the same job
      dbpQuery "mydb" "products" "job_no = [#34][mydb.job.job_no][#34]"
           If "[mydb.products.$RecCount]" "=" "0"
              SetVar "[DisplayProductLoop]" "1"
           Else
              SetVar "[DisplayProductLoop]" "[mydb.products.$RecCount]"
      EndIf
      .Create loop to change entry including colour in table based on date
      Loop "1" "[DisplayProductLoop]" "[WorkLoop]"
              Setvar "[WorkRequired[job_loop_pos]]" "[mydb.products.other_info]"
              SetVar "[product[job_loop_pos]]" "[mydb.products.model]"
              .Convert Job Required date to Julian format
              StrParse "[mydb.job.DateRequired]" "/" "[WD_date]" "[null]"
              .reverse date format
              SetVar "[RtInputVar1]" "[WD_date3][WD_date2][WD_date1]"
              rtDate2Julian
              SetVar "[JobDate_Julian]" "[RtResult]"
              .Convert Todays date to Julian format
              rtTodayAs_YYYYMMDD
              SetVar "[RtInputVar1]" "[RtResult]"
              rtDate2Julian
              SetVar "[TodayDate_Julian]" "[RtResult]"
         .If the Job date is smaller than todays date it is late and so we write the html line with the following parameters
              Setvar "[TodayDate_Julian_minus7]" "[TodayDate_Julian]-7"
              If "[jobdate_julian]" ">" "[TodayDate_Julian_minus7]"
                    SetVar "[Table_Line]" "<tr>[#13]<td bgcolor=[#34]#FFC400[#34] width=[#34]10%[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[job[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFC400[#34] width=[#34]327[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[customer[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFC400[#34] width=[#34]340[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[product[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFC400[#34] width=[#34]352[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[WorkRequired[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFC400[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[Required[job_loop_pos]]</font></td>[#13]</tr>[#13]"
              EndIf
              If "[JobDate_Julian]" "<=" "[TodayDate_Julian]"
                    SetVar "[Table_Line]" "<tr>[#13]<td bgcolor=[#34]#FF4000[#34] width=[#34]10%[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[job[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FF4000[#34] width=[#34]327[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[customer[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FF4000[#34] width=[#34]340[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[product[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FF4000[#34] width=[#34]352[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[WorkRequired[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FF4000[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[Required[job_loop_pos]]</font></td>[#13]</tr>[#13]"
              EndIf
                   Setvar "[TodayDate_Julian_plus7]" "[TodayDate_Julian]+7"
              If "[JobDate_Julian]" ">" "[TodayDate_Julian_plus7]"
                    setVar "[Table_Line]" "<tr>[#13]<td bgcolor=[#34]#FFFFFF[#34] width=[#34]10%[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[job[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFFFFF[#34] width=[#34]327[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[customer[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFFFFF[#34] width=[#34]340[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[product[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFFFFF[#34] width=[#34]352[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[WorkRequired[job_loop_pos]]</font></td>[#13]<td bgcolor=[#34]#FFFFFF[#34]><font face=[#34]Arial[#34] size=[#34]4[#34]>[Required[job_loop_pos]]</font></td>[#13]</tr>[#13]"
              Endif
                   FileWrite "[PubDir]table1.html" "Append" "[Table_Line]"
              SetVar "[Table_Line]" ""
         dbpNext "mydb" "products"
      EndLoop
   EndIf
EndLoop
.Create termination for html page
SetVar "[Table_Line]" "</table>[#13][#13]</body>[#13][#13]</html>"
FileWrite "[PubDir]table1.html" "Append" "[Table_Line]"
.Reload new data
RefreshObject "WebBrowser2"
.Start timer to refresh in 60 seconds (Timer calls Timerstop command before calling subroutine)
TimerStart "Timer4" "60000"
ShowObject "WebBrowser2" "Wipe Down" "1"
Return

*****END****
I guess what I need is to make it run slower so that it doesn't use all the processor time. I really need it to run in the background in a different thread.
At least the code is now readable (I must write neater code)

Thanks
DaveJ
 
Posts: 90
Joined: Tue Dec 30, 2008 11:06 am


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron