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

Having fun with multiple monitors

Post by richmond62 » Tue Mar 10, 2020 1:07 pm

I thought I would be clever (normally a bad idea in my case), so set up a preferences page
in my Devawriter Pro:
-
Prefs.jpg
-
This pops a value into a custom property of the main stack
called "POZZZ": "LL", "MM" or "RR" (which should be self-explanatory).

Should all be dead simple . . .

HOWEVER
, I have 3 monitors attached to my Mac Mini:
-
Screenshot 2020-03-10 at 14.04.12.png
-

BUT when I click on the right-hand picture the stack ends up on the right hand side of my left-most monitor,

when I click on the left hand side picture the stack ends up on the left hand side of the central monitor.

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 1:27 pm

What did you script for this so far? That info COULD be helpful.
Do you use -> line 1 of the screenrects as the reference for positioning the stack? 8)

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 1:43 pm

line 1 of the screenrects
A line that is worth such a lot . . .

I'm doing this:

Code: Select all

switch the POZZZ of stack "DWPro"
      put ((item one of the screenLoc) * 2) into WIDD
   case "LL"
      set the left of stack "DWPro" to 10
      break
   case "RR"
      set the right of stack "DWPro" to (WIDD - 10)
      break
   case "MM"
      set the loc of stack "DWPro" to the screenLoc
      break
end switch

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 2:07 pm

This:

Code: Select all

switch the POZZZ of stack "DWPro"
      put (item 3 of line 1 of the screenrects) into WIDD
      put (item 4 of line 1 of the screenrects) into HITE
   case "LL"
      set the left of stack "DWPro" to 10
      set the top of stack "DWPro" to 100
      break
   case "RR"
      set the loc of stack "DWPro" to (WIDD - 510),(HITE/2)
      set the top of stack "DWPro" to 100
      break
   case "MM"
      set the loc of stack "DWPro" to the screenLoc
      set the top of stack "DWPro" to 100
      break
end switch
if POZZZ is "RR" still pushes the stack over onto the right hand side of the left hand monitor.

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 2:26 pm

What about this one:

Code: Select all

...
  lock screen
  
  ## Not sure if it is a good idea to put this inside of the SWITCH structure.
   put (item 3 of line 1 of the screenrects) into WIDD
   put (item 4 of line 1 of the screenrects) into HITE
   switch the POZZZ of stack "DWPro"
      case "LL"
         set the left of stack "DWPro" to 10
         break
      case "RR"
         ## !!! Just like LL
         set the right of stack "DWPro" to WIDD
         ## !!! 8-)
         break
      case "MM"
         set the loc of stack "DWPro" to the screenLoc
         break
   end switch
   
   ## Avoid too much typing:
   set the top of stack "DWPro" to 100
   unlock screen
...

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 2:34 pm

Still throws the stack off to the left monitor with "RR"

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 2:39 pm

Please post all lines of your "screenrects".
-> item 3 of line 1 of the screenrects ## WIDD
Is definitively the right border of your main monitor, so this SHOULD do the right thing.

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 3:39 pm

0,0,1920,1080
1920,0,3200,1024
-1600,0,0,1200

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 3:49 pm

OK, what I exspected. So:

Code: Select all

answer WIDD
Should show -> 1920
Does it?

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 4:26 pm

NO: neither

Code: Select all

answer WIDD
or

Code: Select all

put WIDD
inwith the cardScript return anything at all.

BUT

Code: Select all

put (item 3 of line 1 of the screenrects)
returns 1920 when I run it in the messageBox.

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 4:28 pm

Please post your final/last script that does not work!

Maybe I was right with?
## Not sure if it is a good idea to put this inside of the SWITCH structure.

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 4:36 pm

You are a genius (or just gifted with the voice of experience) as moving 'that' out
of the switch statement did the job:

Code: Select all

on preOpencard
   set the vis of stack "DWPro" to false
   set the lockScreen to true
   set the title of stack "DWPro" to "       "
   set the width of stack "DWPro" to 1000
   set the height of stack "DWPro" to 688
   ---
   put (item 3 of line 1 of the screenrects) into WIDD
   put (item 4 of line 1 of the screenrects) into HITE
   put WIDD
   ---
   switch the POZZZ of stack "DWPro"
      case "LL"
         set the left of stack "DWPro" to 10
         break
      case "RR"
         set the right of stack "DWPro" to (WIDD - 10)
         break
      case "MM"
         set the loc of stack "DWPro" to the screenLoc
         break
   end switch
   set the top of stack "DWPro" to 100
   set the lockScreen to false
   set the vis of stack "DWPro" to true
end preOpencard

HOWEVER
. . . I wish I could understand why that was not working inside the switch structure.

Thank you for taking the time to help me, once again. :D

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 4:43 pm

I already posted this two hours ago, why didn't you take my advice the first time resp. tried my script?
That was a rhetorical question! 8)

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 5:16 pm

why didn't you take my advice the first time
How can I start?

Bloody-mindedness?

Likes to paddle his own canoe?

Death-wish? 8)

It wasn't really 2 hours as I was asleep with the cat for 1 hour of that. :D

HOWEVER
. . . I still do not understand why putting data into a variable inside a switch statement did not work.

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 5:43 pm

Maybe because it just doesn't work this way?
Since this is not related to SWITCH in any way?

And please look up "rhetorical" somewhere. :D

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”