Windows 10? Issue on German PC?

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
Rob van der Sloot
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 59
Joined: Sat Apr 17, 2010 9:21 am

Windows 10? Issue on German PC?

Post by Rob van der Sloot » Wed Aug 22, 2018 6:44 pm

<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>

Klaus
Posts: 10394
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Windows 10? Issue on German PC?

Post by Klaus » Wed Aug 22, 2018 7:03 pm

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

Rob van der Sloot
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 59
Joined: Sat Apr 17, 2010 9:21 am

Re: Windows 10? Issue on German PC?

Post by Rob van der Sloot » Thu Aug 30, 2018 7:17 pm

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

Klaus
Posts: 10394
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Windows 10? Issue on German PC?

Post by Klaus » Thu Aug 30, 2018 7:25 pm

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

Rob van der Sloot
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 59
Joined: Sat Apr 17, 2010 9:21 am

Re: Windows 10? Issue on German PC?

Post by Rob van der Sloot » Fri Aug 31, 2018 1:07 pm

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

Klaus
Posts: 10394
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Windows 10? Issue on German PC?

Post by Klaus » Fri Aug 31, 2018 1:18 pm

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

Rob van der Sloot
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 59
Joined: Sat Apr 17, 2010 9:21 am

Re: Windows 10? Issue on German PC?

Post by Rob van der Sloot » Sat Sep 01, 2018 7:33 pm

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

Klaus
Posts: 10394
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Windows 10? Issue on German PC?

Post by Klaus » Sat Sep 01, 2018 7:38 pm

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

Post Reply

Return to “Windows”