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: Klaus, FourthWorld, heatherlaine, kevinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 4346
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Having fun with multiple monitors

Post by richmond62 » Tue Mar 10, 2020 6:41 pm

I understand "rhetorical" full well, but I felt like a spot of fun, so I replied to your
question anyway.

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

Re: Having fun with multiple monitors

Post by Klaus » Tue Mar 10, 2020 6:44 pm

richmond62 wrote:
Tue Mar 10, 2020 6:41 pm
I 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: 4346
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Having fun with multiple monitors

Post by richmond62 » Tue Mar 10, 2020 7:34 pm

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

bogs
Posts: 4608
Joined: Sat Feb 25, 2017 10:45 pm

Re: Having fun with multiple monitors

Post by bogs » 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
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 4346
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Having fun with multiple monitors

Post by richmond62 » Tue Mar 10, 2020 8:47 pm

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: 6610
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Having fun with multiple monitors

Post by dunbarx » Tue Mar 10, 2020 10:50 pm

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: 309
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Having fun with multiple monitors

Post by jameshale » Wed Mar 11, 2020 1:35 am

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: 1087
Joined: Thu Apr 11, 2013 11:27 am

Re: Having fun with multiple monitors

Post by LCMark » Wed Mar 11, 2020 7:24 am

@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: 4346
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Having fun with multiple monitors

Post by richmond62 » Wed Mar 11, 2020 8:41 am

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

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”