Sign in to follow this  
Followers 0
meisandy

Size Objects depending on Screen Size

10 posts in this topic

Hi,

This isn't really an autoit related question, more a logical question...

I am making a GUI that will be fullscreen using @DestopHeight & @Desktop width, with various inputs.

But I need to work out how to ensure that the different elements aren't over/under sized on different size screens.

Any pratical ideas? I've thought of dividing into to collunms but it's quite long and drawn out, but I thought there may be an easier way.

Thanks in advanced!

Share this post


Link to post
Share on other sites



DjATUit,

Welcome to the wonderful world of GUICtrlSetResizing! ;)

Look what happens when you try resizing this GUI: :)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Test", 500, 200, Default, Default, BitOr($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))

$hButton = GUICtrlCreateButton("Test", 10, 10, 80, 30)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)

$hLabel = GUICtrlCreateLabel("Test", 100, 10, 380, 60)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
GUICtrlSetBkColor(-1, 0xFF0000)

$hList = GUICtrlCreateList("", 10, 80, 400, 100)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

You can also set the resizing mode as a default for all controls using Opt("GUIResizeMode", ##). ;)

Have fun! :P

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Yet again Melba, you've done it!

You never fail to impress me - it's not just your knowledge it's the way you express it and your attitude towards all kinds of questions.

Thank you very much

DjATUit

Share this post


Link to post
Share on other sites

DjATUit,

Thank you for that - nice to get some feedback. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi, again, not sure if anyone will still pay attention to this post but...

I've just Review what Melba said and it's all good but I need an example closer to what I'm looking for which is:

I'm creating a GUI which is full screen so you wont be able to see the taskbar, etc - using @DesktopHeight and @DesktopWidth but ofcorse there's more than one screen size, so I need to make sure what ever the screen size is, all the preporstions are the same.

Anyone done that before or knows how to do it?

Please Help!

Share this post


Link to post
Share on other sites

DjATUit,

My solution still works. ;)

Create your window to suitable initial size and then use WinMove to size it to the actual screen dimensions. Here is an example to show what I mean: ;)

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 1280, 960, 0, 0)

$hButton_1 = GUICtrlCreateButton("800x600", 10, 10, 80, 30)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)

$hButton_2 = GUICtrlCreateButton("1280x960", 110, 10, 80, 30)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)

$hButton_3 = GUICtrlCreateButton("Full Screen", 210, 10, 80, 30)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)

GUICtrlCreateLabel("", 300, 10, 480, 60)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
GUICtrlSetBkColor(-1, 0xFF0000)

GUICtrlCreateLabel("", 1160, 850, 100, 100)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
GUICtrlSetBkColor(-1, 0x0000FF)

$hList = GUICtrlCreateList("", 10, 80, 400, 400)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton_1
            WinMove($hGUI, "", 0, 0, 800, 600)
        Case $hButton_2
            WinMove($hGUI, "", 0, 0, 1280, 960)
        Case $hButton_3
            WinMove($hGUI, "", 0, 0, @DesktopWidth, @DesktopHeight)
    EndSwitch
WEnd

I would suggest that you make the initial GUI to standard screen dimensions as above and adjust the initial control sizes so that they do not look too small or too large when you change the GUI dimensions to fit.

Now all you need is the WinMove($hGUI, "", 0, 0, @DesktopWidth, @DesktopHeight) line in your script after the GUI is created and it should work as you want. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

M23, I had no doubt your solution still worked - infact I was about to ask you about it (PM) when I saw you was posting on my topic!

Thanks for the example and that was what I had in mind but I was just wondering if there was anything else, etc.

But Thank you loads Melba,

DjATUit

Share this post


Link to post
Share on other sites

DjATUit

in fact I was about to ask you about it (PM)

I am very glad you did not do that as it is considered extremely rude here. ;)

Just stick with posting in the forum (start a new topic if necessary) - that way everyone gets to see and learn, whcih is why we are all here in the first place. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

DjATUit

I am very glad you did not do that as it is considered extremely rude here. ;)

M23

And in my case it probably would not elicit the desired type of reply.

You only use PM's to get support when requested to do so.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Oh okay, extremely sorry everyone

Thanks for that and everything else you help with

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0