Multiple Screen Issue

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Multiple Screen Issue

Post by WaltBrown » Mon Sep 20, 2010 4:59 pm

Hi!
I frequently use my laptop with a second screen. When I unplug the screen, all other apps and the OS (Vista x64) recognize that and send all windows to the laptop screen when I reopen the apps. Except Rev (and LC) do not. When I open the Dictionary for example, it opens up on the second screen where I had it last, even when restarting Rev, and I can't figure out how to get it back without plugging into a second monitor and dragging it back. Anyone have any easier ways to get Rev to recognize the second screen is unplugged?
Thanks,
Walt
Walt Brown
Omnis traductor traditor

shadowslash
Posts: 344
Joined: Tue Feb 24, 2009 6:14 pm
Contact:

Re: Multiple Screen Issue

Post by shadowslash » Mon Sep 20, 2010 6:58 pm

Umm won't hacking into the rev's IDE scripts help? I'm just throwing a wild guess here since I haven't used multiple monitors with rev before.

EDIT:
I meant LiveCode, not rev. Image
Parañaque, Philippines
Image
Image

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Multiple Screen Issue

Post by sturgis » Mon Sep 20, 2010 10:32 pm

I cheat to do this. I have things setup so that when I plug in my 2nd monitor it becomes the primary monitor, meaning the top bar moves to the 2nd mon. Then, I just leave rev/lc setup to display on the primary. This is on snow leopard, I seem to recall that leopard may have trouble remembering to move the menu bar over and that you'd have to do it manually every time which would suck. I'll check it on my other machine in a bit once I get it re-setup.

But this way, plug it in, 2nd becomes primary, menu bar and rev move over. Unplug it, laptop screen returns to being primary and again, rev moves back to the laptop. Very easy, and it works.
WaltBrown wrote:Hi!
I frequently use my laptop with a second screen. When I unplug the screen, all other apps and the OS (Vista x64) recognize that and send all windows to the laptop screen when I reopen the apps. Except Rev (and LC) do not. When I open the Dictionary for example, it opens up on the second screen where I had it last, even when restarting Rev, and I can't figure out how to get it back without plugging into a second monitor and dragging it back. Anyone have any easier ways to get Rev to recognize the second screen is unplugged?
Thanks,
Walt

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Multiple Screen Issue

Post by bn » Mon Sep 20, 2010 11:09 pm

Walt,

look at screenrect and screenrects in the dictionary. If the screenrects is only one line you have only one monitor, if it is 2 lines, you have 2 monitors. On each line are 4 items: the rect of the screen in global coordinates.
Look at the stack names with the stacks function.

Then you can adjust the location of your tools accordingly. You could even write a plugin that starts at startUp of Rev (IDE) to take care of this. A plug-in is just a stack in a special folder in your documents folder -> myRevolutionNameOfEdition.
You than configure it to be active at startUP in Rev -> Development -> Plugins -> Plugin Settings.

regards
Bernd

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Multiple Screen Issue

Post by WaltBrown » Tue Sep 21, 2010 2:18 am

Thanks guys. With only the laptop, I get a single normal rect (like 0,0,1280,960) from screenRects.

But what is interesting, if I get all open stacks and their rects, I get:

revTools, 7,136,91,595
Untitled 1, 111,145,843,698
revMenubar, 60,30,868,105
revDictionary, 598,-1005,1362,-529
revStartCentre, 291,175,990,625

So revDictionary is still at home in my basement office on the second screen :-)

Yes, I can script it to move back to the laptop screen, but would that be a bug, or am I missing a preference setting or something for it to act that way? Anyone have a pointer to where openStack is handled in the engine so I can make my own preference script?

Walt
Walt Brown
Omnis traductor traditor

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Multiple Screen Issue

Post by WaltBrown » Tue Sep 21, 2010 2:22 am

Or even a more useful question - since the IDE is described as modifiable (at my own risk of course), how does one unlock the revDictionary stack so it CAN be modified?
Thanks,
Walt

PS: Is there any doc that describes how to modify the IDE?
Walt Brown
Omnis traductor traditor

shadowslash
Posts: 344
Joined: Tue Feb 24, 2009 6:14 pm
Contact:

Re: Multiple Screen Issue

Post by shadowslash » Tue Sep 21, 2010 3:45 am

WaltBrown wrote:Or even a more useful question - since the IDE is described as modifiable (at my own risk of course), how does one unlock the revDictionary stack so it CAN be modified?
Thanks,
Walt

PS: Is there any doc that describes how to modify the IDE?
Before anything else, ensure that you copy a ackup of your rev folder somewhere else in ur hard drive so restoring would be easy later on in case you screw something up. And yes you can do that, by holding the Ctrl + Shift (Cmd + Shift on a Mac) and right clicking on whatever part of the interface you wish to edit.
Image
Parañaque, Philippines
Image
Image

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Multiple Screen Issue

Post by Mark » Tue Sep 21, 2010 10:36 am

You might create a plugin with a backscript containing a desktopChanged handler. You might also add a preOpenStack handler, which compares the rect of the target stack to the rect of line 1 of the screenRects.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Multiple Screen Issue

Post by WaltBrown » Wed Sep 22, 2010 1:45 am

Thanks Mark and Slash for the tips.

I am looking at revDictionary's backscripts using S. Pothier's old MC script reader utility script to see if I can spot the most appropriate place to mod it's process. If I discover a relatively non-klugey way to do this I'll post it.

Walt
Walt Brown
Omnis traductor traditor

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Multiple Screen Issue

Post by WaltBrown » Sun Sep 11, 2011 3:05 am

I'd like to return to this. Since every stack has a "preOpenStack" message, and since all stacks, including all the IDE stacks, open to their last saved screen location, how can I locate where in the IDE the core "preOpenStack" message is handled? Then I could put a hook in the IDE that does something like (I'm going to pseudo code it):

if my last location is within the screenRects then do nothing
else change my location to something that is within the screenRects.

It would be very simple, but the hard part is I am looking from the outside in. Does anyone know if there a way to see the message flow within the IDE as it opens, so I can identify the urpreLoadStack?

Thanks,
Walt
Walt Brown
Omnis traductor traditor

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Multiple Screen Issue

Post by Mark » Sun Sep 11, 2011 4:17 am

Hi Walt,

You might want to read this thread on the mailing lkist.

Kind regard,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Multiple Screen Issue

Post by WaltBrown » Sun Sep 11, 2011 6:28 am

Thanks Mark. As you were answering, I wrote this kludge:

Code: Select all

case "Retrieve lost windows"
   local tCurWin, tCurScreen
   repeat for each line tCurWin in the windows
      repeat for each line tCurScreen in the screenRects
         if ((the topLeft of stack tCurWin is not within tCurScreen) and \
               (the bottomRight of stack tCurWin is not within tCurScreen)) then
            resetWin(tCurWin)
         end if
      end repeat
   end repeat
exit switch
and dropped it into the menu case statement of the menuPick handler of the View button of revMenuBar, and added "Retrieve lost windows" to the View button's list of options. I also dropped the subroutine:

Code: Select all

on resetWin pWin
   local tRestoreLoc
   put the "cREVRestoreLoc" into tRestoreLoc

   if tRestoreLoc is not empty then 
      set the location of stack pWin to tRestoreLoc
      exit resetWin
   end if
   
   if (pWin contains "revTools") then 
      set the rect of stack pWin to 34,133,118,592
      exit resetWin
   end if
   set the location of stack pWin to the location of stack "revStartCentre"
end resetWin
and of course it failed to compile as I needed some permission for a backup process LC has hidden inside it for code changes, and after that failed it lunched my entire 4.6.4 installation, so I did a clean remove and reinstall. :-)

But I did make some interesting discoveries.

Some LC stacks know about changed screen configurations when starting up, notably revMenubar and revStartCentre. revToolbar and revDictionary notably do NOT, and stay lost after going from two to one screen, if they were on the second screen.

Apparently someone at LC had started to fix this but didn't complete the process - some of the LC stacks have a custom property named "cREVRestoreLoc" oddly enough, and when started apparently look there if they can't go to their last location - revMenuToolbar and revStartCentre having the cREVRestoreLoc. I tried to put cREVRestoreLoc in revToolbar and revDictionary as a test but sadly it's not looked at from some central function.

Anyway, I'll look more at the thread you sent, thanks.

Walt
Walt Brown
Omnis traductor traditor

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Multiple Screen Issue

Post by mwieder » Tue Sep 13, 2011 5:55 pm

put the "cREVRestoreLoc" into tRestoreLoc
I hope that isn't real code pasted from your editor...

the "cREVRestoreLoc" is guaranteed not to work, probably cause compiler errors, and since it's in a system stack, probably also guaranteed to crash the IDE. At the very least you want something like

Code: Select all

put the cREVRestoreLoc of stack pWin

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Multiple Screen Issue

Post by WaltBrown » Tue Sep 13, 2011 6:54 pm

It did all of the above :-)
Walt Brown
Omnis traductor traditor

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Multiple Screen Issue

Post by sturgis » Tue Sep 13, 2011 7:33 pm

Seems like this would be a good candidate for a plugin set to open with the IDE.

Something like this pseudocode.
on openstack
check the number of screens.
if the number of screenrects is < 2 then cycle through the open windows and set them to a pre-designated spot for each for single screen default config.
If a window doesn't have a saved setting, plop it in the center of the main screen.
Otherwise return it to its "single screen" position.
otherwise if theres more than 1 screenrect listed,
confirm that all windows are in viewable locations. (IE set them to another "saved" position)
end openstack

Set up things so that configurations can be saved and reloaded, have a default 1 screen setup saved, and a default 2 screen (or whatever) setup saved, and a button to load a configuration from the plugin on demand. (with checks to make sure an impossible configuration isn't chosen?)

Just a thought.

Post Reply