IDE Scale issues

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

istech
Posts: 199
Joined: Thu Sep 19, 2013 10:08 am

IDE Scale issues

Post by istech » Fri Sep 01, 2023 5:19 am

Hi Livecoders,

Just a quick question on a pet peeve I have had with the IDE. Do you know how I can overcome the fact that when I scale an app down when I close it and open the app it goes off screen and I need to use the inspector to relocate the stack to within my screen? This only happens on scaled stacks. Is there any solution to this issue? The same for any app prompts as they happen off-screen and are very annoying to deal with. Many thanks

While I am at it is there an option to have the project browser stay on top of the IDE? Can be quite annoying searching for it sometimes. (Maybe should do this under another thread to help someone else out)

Many thanks

stam
Posts: 2756
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: IDE Scale issues

Post by stam » Fri Sep 01, 2023 9:24 am

These and other issues are old. LC is re-writing the IDE with next version, I guess we have to be patient….

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

Re: IDE Scale issues

Post by Klaus » Fri Sep 01, 2023 1:20 pm

Hi istech,

new IDE or not, this sounds like a bug and therefore needs to be reported!
Sounds like the IDE is mixing the "scaled loc" with the "unscaled loc" of your stack(s).
While I am at it is there an option to have the project browser stay on top of the IDE? Can be quite annoying searching for it sometimes.
You could try to:

Code: Select all

set the systemwindow of stack "revIDEProjectBrowser" to TRUE
Or maybe just set its style to PALETTE:

Code: Select all

palette "revIDEProjectBrowser"
This needs to be done with the M"essage Box" or a little plug-in.

Best

Klaus

istech
Posts: 199
Joined: Thu Sep 19, 2013 10:08 am

Re: IDE Scale issues

Post by istech » Fri Sep 01, 2023 8:10 pm

Hi Klaus,

Thanks for this. I wonder when a simple option like this can be added to the project browser settings. The "system window" option seems to work best for my needs.

Hopefully, the next version of the IDE has some really intuitive features. Not played with LC 10 as yet, maybe I should give it a go.

stam
Posts: 2756
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: IDE Scale issues

Post by stam » Tue Sep 19, 2023 10:39 am

Personally I manage the window scaling and position in a preferences file.

Not in the least because I have many users that will use the app on a number of different computers that can have vastly different resolutions (and annoyingly, given that these are windows machines, magnifications as well - so for the same resolution there can still be a huge difference in, well, resolution as sometimes machines are set to magnify to 150%... sigh).

I include controls in the app to scale the interface up or down (or reset to default) and every time that happens a preferences file (just a text file) is updated on a local machine directory. The file structure is pretty simple, it's just key-value pairs separated with a ":", and include scaling and stack location, which are set on change and on quit and read/restored on startup.

That way I don't have to worry about these things, they are set to whatever the user sets them to and restored on startup.

HTH
Stam

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7258
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: IDE Scale issues

Post by jacque » Tue Sep 19, 2023 5:31 pm

AI bot. First post 1 minute after joining, generic info, and there has never been a "Use default location" option in the stack's property inspector. Even if there was, you can't access the property inspector before opening the stack.

Edit : I see the mods agree, the post has disappeared.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

stam
Posts: 2756
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: IDE Scale issues

Post by stam » Tue Sep 19, 2023 6:15 pm

jacque wrote:
Tue Sep 19, 2023 5:31 pm
Edit : I see the mods agree, the post has disappeared.
Our mods are good that way ;)

Lance
Posts: 23
Joined: Sat Sep 05, 2020 2:36 pm
Location: Anchorage, Alaska

Re: IDE Scale issues

Post by Lance » Wed Sep 20, 2023 4:38 pm

Hello Stam,

Do you happen to have a sample stack on how you resize and use your preferences file? I think that could be very helpful for me.

thanks.

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

Re: IDE Scale issues

Post by richmond62 » Wed Sep 20, 2023 4:54 pm

My gifted 2015 iMac is blowing my screenshots up in a very odd way . . . the Retina display, I suppose: not that convenient.

stam
Posts: 2756
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: IDE Scale issues

Post by stam » Wed Sep 20, 2023 5:46 pm

Lance wrote:
Wed Sep 20, 2023 4:38 pm
Hello Stam,

Do you happen to have a sample stack on how you resize and use your preferences file? I think that could be very helpful for me.

thanks.
Sure… I’m abroad so will be a slight delay, will post a simplified example when I can…

Lance
Posts: 23
Joined: Sat Sep 05, 2020 2:36 pm
Location: Anchorage, Alaska

Re: IDE Scale issues

Post by Lance » Wed Sep 20, 2023 5:51 pm

Thank you Stam.

stam
Posts: 2756
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: IDE Scale issues

Post by stam » Wed Sep 20, 2023 10:06 pm

Lance wrote:
Wed Sep 20, 2023 5:51 pm
Thank you Stam.
Hi Lance,

I've attached a cut-down version focusing on scaling and location of stack. In this example, it creates a text file in the specialFolderPath("support") folder.
Almost all code is in the stack script:

Code: Select all

global gSettings
constant kMinScale = 0.8
constant kMaxScale = 1.5

/* SETTINGS TEXT FILE ORDER BY LINE:
scaleFactor:<the numerical value>
stackLocation:<the coordinates for the centre point of the stack>
*/

command loadSettings
    put URL ("file:" & specialFolderPath("support") & slash & "TESTAPP settings.txt") into gSettings
    if gSettings is empty then exit loadSettings
    set the itemDelimiter to ":"
    set the scaleFactor of this stack to item 2 of line 1 of gSettings 
    set the loc of this stack to item 2 of line 2 of gSettings    
end loadSettings

command saveSettings
    local tPath
    put "ScaleFactor" & ":" &  the scaleFactor of this stack into line 1 of gSettings
    put "stackLocation" & ":" & the loc of this stack into line 2 of gSettings
    put specialFolderPath("support") & slash & "TESTAPP settings.txt" into tPath
    put gSettings into URL ("File:" & tPath)
end saveSettings

command doScale pDirection, pID 
    -- increments or decrements scaling by 0.05 unless hits the limits in set by the constants above
    -- pID is the long ID of the caller, to dispatch a callback.
    switch pDirection
        case "shrink"
            if the scaleFactor of this stack >= kMinScale then
                set the scaleFactor of this stack to the scaleFactor of this stack  - 0.05
            end if
            break
        case "default"
            set the scaleFactor of this stack to 1
            break
        case "magnify"
            if the scaleFactor of this stack <= kMaxScale then
                set the scaleFactor of this stack to the scaleFactor of this stack  + 0.05
            end if
            break
        default
            -- do nothing if empty
    end switch
    
    #send callback to buttonBar to disable shrink or magnify buttons if at limits (set in constants above)
    dispatch "disableEdgeButtons" to pID with kMinScale, kMaxScale
    
    # update gSettings and write to file
    saveSettings
end doScale

on moveStack
    # detect stack movement and  update prefs file
    saveSettings
end moveStack

a simple preOpenStack handler is in the card script loading the prefs at startup.
There is some minor code in the buttonBar to grey out buttons if they hit the preset limits, which are defined as constants in the stack script.

Let me know if something doesn't make sense (I tested it briefly as it's always error prone copying code across to other projects, it seemed to work exactly as expected).

HTH
Stam

------- EDITED --------
Code slightly simplified/refactored (it's never pretty looking at old code ;) ). Also added correct build settings, as this only really shows in a built app (the IDE saves position/scaling, but not the standalone, I don't think anyway!). To test this in action, just build standalone for your platform and it should work...
Attachments
stackResizeWithPrefs.livecode.zip
(3.31 KiB) Downloaded 65 times

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

Re: IDE Scale issues

Post by richmond62 » Thu Sep 21, 2023 10:06 am

Phew: turned off the retina display thing (after 2 weeks!), and I hope my screenshots won't blow up out of control when posted in forums.

Of course no-one can expect customers to turn off this sort of thing.

stam
Posts: 2756
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: IDE Scale issues

Post by stam » Thu Sep 21, 2023 10:42 am

richmond62 wrote:
Thu Sep 21, 2023 10:06 am
Phew: turned off the retina display thing (after 2 weeks!), and I hope my screenshots won't blow up out of control when posted in forums.

Of course no-one can expect customers to turn off this sort of thing.
Not sure what question you’re answering, but you do know you can adjust size and resolution in Preview.app right?
And that you can open a screenshot directly in Preview before the file is even created?

Surely that’s the thing to do rather than lowering your screen’s resolution?

In any case, it is usually essential to open screenshots in Preview to export as JPG and adjust the JPG compression so the file size is < 200Kb, or you won’t be able to load. But part of that is shrinking the image before exporting to JPG, so that you don’t have to compress as much…

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

Re: IDE Scale issues

Post by richmond62 » Thu Sep 21, 2023 10:46 am

1. About Preview: Yes, I have been using that for that since about 2002.

2. I turned off Retina because it was playing "silly buggers' in many respects: personally, things now seem to have stabilised.

3. I am not sure if I am answering any questions: but I might be raising one about scaling that refers to desktop computers.

Post Reply

Return to “Talking LiveCode”