Jump to content

Fixed Size GUI with scroll bars for smaller screens


Recommended Posts

Hello,

I've been using AutoIt for automating several things around here. One thing that I am trying to do is create an interface to display data from a text file into data boxes on top of an image. I've spent a few weeks and have it looking and working the way I want - with one exception. I've sized the images and boxes to display properly on a 1680x1050 screen in a Maximized window. However, there may be a case where I need to display on a smaller screen for other purposes. What I would like to do is display the GUI at a fixed 1690x1050 window size and have scoll bars that move the images/data boxes around. I would like to be able to minimize, maximize, and resize the window. The scroll bars should only come into play when the window is in resize mode or when maximized on a less than 1690x1050 screen. However, I can't seem to be able to figure that part out - even after looking on the forums.

To demonstrate what I have, I wrote a short example script. It creates the GUI and puts a docked 900x400 label in the upper left corner. When the script is run and "Restore Down" (resize) is pressed and the window is resized smaller, I need scroll bars to be able to slew around to see the rest of the interface.

Any suggestions / ideas?

Problem_GUI.au3

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Contents of Problem GUI.au3:

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <StaticConstants.au3>

Opt("GUIOnEventMode", 1)

$mainwindow = GUICreate("Interface",1680,1050,-1,-1, BitOr($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX, $WS_MAXIMIZE))

GUISetBkColor(0xFFFF00, $mainwindow)

GUICtrlCreateLabel("THIS IS A DOCKED LABEL", 10, 10, 900, 400 )

GUICtrlSetBkColor(-1, 0x00FFFF)

GUICtrlSetResizing(-1, $GUI_DOCKAll)

GUISetOnEvent($GUI_EVENT_CLOSE, "Close_Clicked")

GUISetState(@SW_SHOW)

While 1

Sleep (200)

WEnd

Func Close_Clicked()

Exit

EndFunc

Link to comment
Share on other sites

Hello,

I've been using AutoIt for automating several things around here. One thing that I am trying to do is create an interface to display data from a text file into data boxes on top of an image. I've spent a few weeks and have it looking and working the way I want - with one exception. I've sized the images and boxes to display properly on a 1680x1050 screen in a Maximized window. However, there may be a case where I need to display on a smaller screen for other purposes. What I would like to do is display the GUI at a fixed 1690x1050 window size and have scoll bars that move the images/data boxes around. I would like to be able to minimize, maximize, and resize the window. The scroll bars should only come into play when the window is in resize mode or when maximized on a less than 1690x1050 screen. However, I can't seem to be able to figure that part out - even after looking on the forums.

To demonstrate what I have, I wrote a short example script. It creates the GUI and puts a docked 900x400 label in the upper left corner. When the script is run and "Restore Down" (resize) is pressed and the window is resized smaller, I need scroll bars to be able to slew around to see the rest of the interface.

Any suggestions / ideas?

Problem_GUI.au3

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Contents of Problem GUI.au3:

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <StaticConstants.au3>

Opt("GUIOnEventMode", 1)

$mainwindow = GUICreate("Interface",1680,1050,-1,-1, BitOr($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX, $WS_MAXIMIZE))

GUISetBkColor(0xFFFF00, $mainwindow)

GUICtrlCreateLabel("THIS IS A DOCKED LABEL", 10, 10, 900, 400 )

GUICtrlSetBkColor(-1, 0x00FFFF)

GUICtrlSetResizing(-1, $GUI_DOCKAll)

GUISetOnEvent($GUI_EVENT_CLOSE, "Close_Clicked")

GUISetState(@SW_SHOW)

While 1

Sleep (200)

WEnd

Func Close_Clicked()

Exit

EndFunc

Have you looked at _GUIScrollBars_Init in the help?
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...