Page 1 of 1

Windows 10? Issue on German PC?

Posted: Wed Aug 22, 2018 6:44 pm
by Rob van der Sloot
<r>I am developing an app for a german company.<br/>
I have windows10 and the client has windows 10.<br/>
<br/>
I have the following script to make "month" buttons (backgroundcolor) green and the text color blue and then select 1 month and make that button red and the text white.<br/>
<br/>
the script looks:<br/>
<COLOR color="#4040FF"><s></s>on SelectMonth<br/>
repeat with n = 1 to 12<br/>
put "set the backgroundcolor of button " & quote & "Month" & n & quote & " to 74,213,85" into tPut<br/>
do tPut<br/>
put "set the textcolor of button " & quote & "Month" & n& quote & " to 0,0,255" into tPut<br/>
do tPut<br/>
end repeat<br/>
put "set the backgroundcolor of button " & quote & "Month" & tMonth & quote & " to " & "255,0,0" into tPut<br/>
do tPut<br/>
put "set the textcolor of button " & quote & "Month" & tMonth & quote & " to " & "255,255,255" into tPut<br/>
do tPut<br/>
end SelectMonth<e>
</e></COLOR><br/>
<br/>
On my pc it runs without problems. I tested the runtime on my pc and it works fine.<br/>
When I run the runtime on a (german) pc of my client then I get a failure bug report before the selected Month has to change. (so after the repeat)<br/>
<br/>
However, when I push one of the month buttons to select another month, then the same script (selectmonth) is called, and then it suddenly works ok on the german PC.<br/>
<br/>
Any suggestions? Thanks<br/>
Rob van der Sloot</r>

Re: Windows 10? Issue on German PC?

Posted: Wed Aug 22, 2018 7:03 pm
by Klaus
Dag Rob,

1. No need to DO anything, just use correct concatenation:

Code: Select all

on SelectMonth
   lock screen
   repeat with n = 1 to 12
      set the backgroundcolor of button ("Month" & n) to 74,213,85
      set the textcolor of button ("Month" & n) to 0,0,255
      do tPut
   end repeat
   set the backgroundcolor of button ("Month" & tMonth) to 255,0,0
   set the textcolor of button ("Month" & tMonth) to 255,255,255
   unlock screen
end SelectMonth
2. tMonth is not declared in this script!
Is it local or global?

If that is not what you mean, please explain.


Best

Klaus

Re: Windows 10? Issue on German PC?

Posted: Thu Aug 30, 2018 7:17 pm
by Rob van der Sloot
Hi Klaus,

The issue was that the month to be changed in color is based on the monthnr, which I calculate from the system date.

put the system date into tDate
replace "-" with " " in tDate (on my PC)
replace "." with " " in tDate (on a German PC)
put Abs(word 2 of tDate) into tMonth

What happened was that this word 2 of the system date should get the month nr. But it turned out that the month number was 08 in stead of 8 (for august). So I made it: put Abs(word 2 of tDate) into tMonth, and that solved the whole problem.

One thing I may be doing wrong is that I often forget to declare locals, because it just works without declaring.
But I don't know what the effects can be. Is it a problem if locals are not declared?

Thanks
Rob

Re: Windows 10? Issue on German PC?

Posted: Thu Aug 30, 2018 7:25 pm
by Klaus
Goedenavond Rob,
Is it a problem if locals are not declared?
not at all, I never do so, but it is a problem if a variable has not been filled with content yet!
In that case it keeps its name as string in it.

I your script tMonth is not initialised, that was what I meant:
...
set the textcolor of button ("Month" & tMonth) to 255,255,255
...


Groetjes

Klaus

Re: Windows 10? Issue on German PC?

Posted: Fri Aug 31, 2018 1:07 pm
by Rob van der Sloot
Goedenmiddag Klaus,

But tMonth needs to be a number, from 1 to 12, so why do I need to put the textcolor in there?

thanks

hartelijke groet,
Rob

Re: Windows 10? Issue on German PC?

Posted: Fri Aug 31, 2018 1:18 pm
by Klaus
Dag Rob,
Rob van der Sloot wrote:
Fri Aug 31, 2018 1:07 pm
But tMonth needs to be a number, from 1 to 12...
exactly!
Rob van der Sloot wrote:
Fri Aug 31, 2018 1:07 pm
... so why do I need to put the textcolor in there?
No idea, ask Mijnheer van der Sloot! :D

I cannot see your complete script, so maybe tMonth IS in fact declared and initialised with a value somewhere, if not, then you will see an error: Can't find Object (or something...)

But maybe you pass tMonth as a parameter to your script and just forgot to write it here?

Code: Select all

on SelectMonth tMonth
   lock screen
   repeat with n = 1 to 12
...

Best

Klaus

Re: Windows 10? Issue on German PC?

Posted: Sat Sep 01, 2018 7:33 pm
by Rob van der Sloot
Hi Klaus,

here is the full scripting for the month selection

put the system date into tDate
put tDate into field "Date"
replace "." with " " in tDate
replace "-" with " " in tDate
put Abs(word 2 of tDate) into tMonth
put tMonth into field "Month"
put word 3 of tDate into tYear
put tYear into field "Year"
set the label of button "Year" to tYear

and then I use tMonth and tYear in a select statement, to get the data I want:

put "SELECT bgID,ctID,FullName,evCode,evComment,bkDate1,bkDate2,bkDays,bkWeek1," & \
"bkWeek2,bkWeek3,bkWeek4,bkWeek5,bkWeek6,bkMonth1,bkMonth2,bkMonth3," & \
"YearNr1,YearNr2 FROM bookingpk WHERE bkMonth1 =" & tMonth & \
" and YearNr1 = " & tYear into tSQL

thanks
Rob

Re: Windows 10? Issue on German PC?

Posted: Sat Sep 01, 2018 7:38 pm
by Klaus
Hi Rob,

OK, get it, I just wanted to point out that tMonth is not declared/initialized in your handler "SelectMonth", that's why I asked if tMonth is declared local or global.


Best

Klaus