Having fun with multiple monitors

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10416
Joined: Fri Feb 19, 2010 10:17 am

Re: Having fun with multiple monitors

Post by richmond62 »

I understand "rhetorical" full well, but I felt like a spot of fun, so I replied to your
question anyway.
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Having fun with multiple monitors

Post by Klaus »

richmond62 wrote: Tue Mar 10, 2020 6:41 pmI understand "rhetorical" full well, but I felt like a spot of fun, so I replied to your
question anyway.
I know! :D
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10416
Joined: Fri Feb 19, 2010 10:17 am

Re: Having fun with multiple monitors

Post by richmond62 »

The most important thing is that the "dirty deed" is now done.
-
Screenshot 2020-03-10 at 19.53.18.png
Screenshot 2020-03-10 at 19.53.18.png (78.74 KiB) Viewed 7486 times
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Having fun with multiple monitors

Post by bogs »

richmond62 wrote: Tue Mar 10, 2020 7:34 pm The most important thing is that the "dirty deed" is now done.
But now, of course, the question is whether or not it "was done dirt cheap!" :P
Image
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10416
Joined: Fri Feb 19, 2010 10:17 am

Re: Having fun with multiple monitors

Post by richmond62 »

bogs wrote: Tue Mar 10, 2020 8:34 pm
richmond62 wrote: Tue Mar 10, 2020 7:34 pm The most important thing is that the "dirty deed" is now done.
But now, of course, the question is whether or not it "was done dirt cheap!" :P
Well, it took me about 60 minutes + 60 minutes in bed with the cat when my brain was going round in circles.

I am still looking for a LOGICAL reason for why including setting variables inside a switch statement did not work.
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10502
Joined: Wed May 06, 2009 2:28 pm

Re: Having fun with multiple monitors

Post by dunbarx »

I learned this a long time ago about "Switch" constructions, which I love.

You just cannot put stuff inside a "Switch" construction, but outside the "case" statements. Check this out, with a button and a field on a new card:

Code: Select all

on mouseUp
   put random(42) into fld 1
   
   switch the number of btns
      --put random(42) into fld 1
      
   case 1
      break
   case 2
      break
end switch
end mouseUp
Comment, in turn, only ONE of the "random" statements. If you comment out the bottomMost, you get a random number. But if you comment the topMost, you get LC ignoring you.

Craig
jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 494
Joined: Thu Sep 04, 2008 6:23 am

Re: Having fun with multiple monitors

Post by jameshale »

Surely once the “switch” statement is read the engine searches for the first “case” statement that qualifies.
Anything else is redundant and ignored.
I daresay any statement between the “switch” and the first “case” will be ignored.
LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1235
Joined: Thu Apr 11, 2013 11:27 am

Re: Having fun with multiple monitors

Post by LCMark »

@jameshale is correct - the switch statement reads the statements inside it in order, and then operates like a jump table:

Code: Select all

switch X
  ... (1)
  case A
    ... (2)
    break
  case B
    ... (3)
  case C
    ... (4)
    break
  default
   ... (5)
 end switch
 
The engine evaluates X - if it matches A then it jumps to (2), when it hits the break it will jump to 'end switch' (skipping the other blocks); it matches B then it jumps to (3), as there is no break it will then continue to execute (4). If it matches C then (4) only executes. If it matches none of them then it jumps to (5) (the default section).

At no point can any statements at point (1) be executed, nor would any statements between any of the breaks and cases.
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10416
Joined: Fri Feb 19, 2010 10:17 am

Re: Having fun with multiple monitors

Post by richmond62 »

Thank you very much for a complete and easily comprehensible answer.
Post Reply