Which Geometry model?

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

Post Reply
golife
Posts: 103
Joined: Fri Apr 02, 2010 12:10 pm

Which Geometry model?

Post by golife » Sat Apr 03, 2021 10:33 am

I am currently developing an end-user application and I want to use a geometry model that is more general than what I am doing now.

Requirements:
  • The card size is changed using (-) 100% (+) scalefactor in percent. It is done. The customer loves it. Unfortunately, the screen flickers no matter what -- setting "lock screen" to true or not. The whole window is zoomed which for my app it is good and bad at the same time.
  • Only the content area is zoomed using (-) 100% (+). Looking for solutions or developing my own. This kind of zooming does not affect the window, side bars, navigation bars, etc., but only the actual content with text sizes also changing. Looking for a solution... or developing it myself. I assume a huge amount of time...
  • The layout automatically adjusts to the screen size on desktop and for mobile (eventually defining break points).
I had problems with the inbuilt geometry manager. It broke so many times. Suddenly, objects appeared 30000 pixels away. So, years ago, I abandoned it. I am aware of the current discussions. Nevertheless, would it ever be a model that could define different scenarios adjusting itself to different screen sizes if it would reliably work?

For the layout flexibility, my idea is a FlexBox model as used in Flutter (originally from Google). There, all is a widget and all is adjusting according to this model. I am thinking of putting all objects into groups (boxes) and groups within groups. So, defined boxes resize relative to each-other and to the overall geometry model. For example, they can appear on desktop in two or more columns, or they can adjust themselves below each-other in just one column. All will be boxes (groups). On mobile, they also would automatically adjust to the screen sizes, some list views will not appear side-by-side with details views, but go to another window, etc.. I think, we all understand how mobile phone apps are working by now...

https://www.w3schools.com/css/css3_flexbox.asp

For this, inner and outer spaces (padding, margins) are defined for each box with standard defaults, and relative to the window size, boxes adjust in rows and columns within specified areas.

Does anybody have experience using the NativeGeometry from NativeSoft? It is published on GitHub, but last commits are quite some time ago. https://github.com/dagirard/NativeGeometry. Nevertheless, it looks mature and promising. It just reminds me that developer tools in LiveCode seem to not be paying as the target group seems to be too small. :shock: But at least, we can exchange and share... 8)

I think, it makes no sense re-inventing the wheel. Maybe others have thought about it more deeply? Or, we can put work together? Or someone is currently working on such a model?

For now, I am using the resizeStack handler on the card and stack level and already my groups are adjusting correctly. But it is not a "model" that could be used outside of such application.

Input is highly appreciated ... :D :D :D

Roland (golife)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9578
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Which Geometry model?

Post by dunbarx » Sat Apr 03, 2021 4:09 pm

Hi.
Unfortunately, the screen flickers no matter what -- setting "lock screen" to true or not.
When you say "flicker" do you mean the "jump" between one size and the next? If so, does this help? I made a new stack with a button. This in the button script"

Code: Select all

on mouseUp
   repeat with y = 1 to 50
      set the scaleFactor of this stack to (50 + y) / 100
      wait 0 with messages
   end repeat
end mouseUp
Now this is only to eliminate the "flicker", if I even know what you meant by that. It needs tweaking to start at one predefined size and end up at another.

Craig

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

Re: Which Geometry model?

Post by stam » Sat Apr 03, 2021 5:32 pm

golife wrote:
Sat Apr 03, 2021 10:33 am
I had problems with the inbuilt geometry manager. It broke so many times. Suddenly, objects appeared 30000 pixels away. So, years ago, I abandoned it. I am aware of the current discussions. Nevertheless, would it ever be a model that could define different scenarios adjusting itself to different screen sizes if it would reliably work?
You've probably have seen the recent conversations about this, but i did finally get the native Geometry Manager to work following Brian's advice... it just needs a few extra steps.

Key thing is to run the following (i just do this in the message box) once your layout is set and you've adjusted the GM for all controls or groups:

Code: Select all

revcachegeometry true
This also need to be run every time you add any controls or groups to the card; for safety's sake i do this often just when changing the layout (super quick in the msg box anyway)...

I also found that the when changing stack size, GM isn't notified of this automatically from one card to the next, so on each card i add:

Code: Select all

on openCard
   revupdateGeometry
end openCard
It's been a huge improvement in my quality of coding life since i've starting doing this...

Hope that helps,
Stam

golife
Posts: 103
Joined: Fri Apr 02, 2010 12:10 pm

Re: Which Geometry model?

Post by golife » Sun Apr 04, 2021 8:38 am

@ Craig: Regarding scalefactor

Using scalefactor, I reposition the window so that it does not jump. This is not about jumping, it is about an unwanted visual effect that makes it look not smooth even though the screen loc stays the same. It is a cosmetic problem, so, not essential.

Let us assume that the latest improvements to the geo manager work, it will be a huge help for many, but is there a way to dynamically and with script control to change it? I guess it is possible somehow, but I left it aside for so long.

I am not sure if it can go as far as a FLEXBOX model that controls basically the whole layout and resizes automatically (based on some rules) for various screen sizes.

Regards, Roland (golife)

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

Re: Which Geometry model?

Post by stam » Mon Apr 05, 2021 8:56 am

golife wrote:
Sun Apr 04, 2021 8:38 am
Let us assume that the latest improvements to the geo manager work, it will be a huge help for many, but is there a way to dynamically and with script control to change it?
I believe the GM (and nativeGeomtry) are just automating a resizeStack handler for you, so I guess not. The whole point of the GM is that you don’t need to code it at all, but that it lets you move or resize stuff. I found personally that this works fairly well for objects relative to the window; but for objects in a group relative to the group, I’m still better off using resizeControl.
golife wrote:
Sun Apr 04, 2021 8:38 am
I am not sure if it can go as far as a FLEXBOX model that controls basically the whole layout and resizes automatically (based on some rules) for various screen sizes.
Pretty sure that with some work, that’s what GM can do. Otherwise what would be the point of it..?
At least for my needs it more or less does, as long as using revCacheGeometry and revUpdateGeometry as above.

I’ve tested this in a project that runs on desktop, iOS and Android (but only in portrait orientation) and it seems to work just fine...

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”