Author Topic: Responsive Form Sizing?  (Read 3701 times)

0 Members and 1 Guest are viewing this topic.

Offline davidshq

  • Newbie
  • Posts: 55
Responsive Form Sizing?
« on: July 06, 2019, 12:06:36 am »
I'm wondering if it is possible to somehow set a responsive form size based on the user's display. In my case I'd like for the app to always open full-screen.

Would be great if one could enter percentage values for width and height of form. With a little work one could set a "design" resolution (e.g. 1920x1080), create everything on the display sized as you'd want on a 1920x1080 and then InForm could figure out what the pixel sizes would look like for any given elements at any screen size...

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
Re: Responsive Form Sizing?
« Reply #1 on: July 06, 2019, 05:46:28 pm »
Hi David
do you talk about an autosize of the window (and its components) created by Inform?

try this code attached!
It works for me that I use to have the WindowsTaskbar on the bottom.

How can you to get this results?

in UIEditor
1. you click first on View and then on Keep preview window attached so you now have no sign of checking near the item above (keep..)
2. now you click on the window's maximize button
3. using window's taskbar go in UiInform to design your window
4. click on the centered window option to be it selected (optional)
5. save the project
6. opening in QB64IDE, in sub __UI_OnLoad type this statement
Code: QB64: [Select]
now you can run the code for the result.

PS I imagine that you have already Inform in QB64 folder.
* maximizeWindow.bas (Filesize: 3.1 KB, Downloads: 244)
* maximizeWindow.frm (Filesize: 1.3 KB, Downloads: 250)
Programming isn't difficult, only it's  consuming time and coffee

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
Re: Responsive Form Sizing?
« Reply #2 on: July 07, 2019, 11:50:54 am »
about
Quote
With a little work one could set a "design" resolution (e.g. 1920x1080), create everything on the display sized as you'd want on a 1920x1080 and then InForm could figure out what the pixel sizes would look like for any given elements at any screen size...
?

mmhhmmm....
it let me think like C/C++ initialization of graphic mode....

a more professional response to this request is that follows


paste in __UI_OnLoad this code that manages manually the position of the items...
Code: QB64: [Select]
  1.     _SCREENMOVE 1, 1
  2.     Control(MaximizedWindowAlways).Height = _DESKTOPHEIGHT
  3.     Control(MaximizedWindowAlways).Width = _DESKTOPWIDTH
  4.  
  5.     Control(InBassoDxLB).Left = Control(MaximizedWindowAlways).Width - Control(InBassoDxLB).Width
  6.     Control(InBassoDxLB).Top = Control(MaximizedWindowAlways).Height - Control(InBassoDxLB).Height - 60 'taskbae on bottom
  7.  
  8.     Control(InAltoSinLB).Left = 10
  9.     Control(InAltoSinLB).Top = Control(InAltoSinLB).Height
  10.  
  11.     Control(AlCentroLB).Left = INT(Control(MaximizedWindowAlways).Width - Control(AlCentroLB).Width) / 2
  12.     Control(AlCentroLB).Top = INT(Control(MaximizedWindowAlways).Height - Control(AlCentroLB).Height) / 2

as you can see you must map the items of the window and then calculate their positions Onload.

As alternative you can force to fullscreen the window...
but you loose the window's aspect

you can type this in the __UI_OnLoad

Code: QB64: [Select]

Good Coding
Programming isn't difficult, only it's  consuming time and coffee