Jump to content

Scrollable GUI's


GaryFrost
 Share

Recommended Posts

I'm very interested alright, although I don't feel like posting just to say so ;)

When I saw that you posted this I was thinking of adding it to my current project,

but with the speed I'm currently at it won't be finished before close to Christmas.

I think the basic reason for that is upgraded internet, sickness and pure laziness.

I'll probably post it here some day...if it's ever gets finished that is :whistle:

I know how that is, I finally took the time to update the GuiListView UDFs to work with System controls.

Might be a while before they get done testing and beta updated on those, had to add a whole bunch of support functions to make it work.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

im getting an error when trying the script from the topicstarter:

C:\tmp\GUIScrollBars.au3(52,31) : ERROR: (): undefined function.

GUIRegisterMsg($WM_CREATE, "")

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\tmp\scroll.au3 - 1 error(s), 0 warning(s)

Any ideas why?

Link to comment
Share on other sites

Hi,

im getting an error when trying the script from the topicstarter:

C:\tmp\GUIScrollBars.au3(52,31) : ERROR: (): undefined function.

GUIRegisterMsg($WM_CREATE, "")

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\tmp\scroll.au3 - 1 error(s), 0 warning(s)

Any ideas why?

Nope, works fine with 3.2.0.1 and latest beta

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • 1 month later...

Surprised there doesn't seem to be much interest in this one.

Still if anyone can help make it better I'll gladly accept the help.

There is inrerest only no replays :)

You are really good API maniac :D

I'm surprised what can be done with AutoIt & API when you know how.

I don't need this functionality for now but thanks for sharing - nice learning stuff for me :P

Link to comment
Share on other sites

Nice job Gary

Have you tried it with child windows?

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!"

Link to comment
Share on other sites

Nice job Gary

Have you tried it with child windows?

This what you mean?

Scrollbars_ChildTest.au3

:P

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

This what you mean?

:P

WOrks for me !!! :D

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!"

Link to comment
Share on other sites

  • 3 months later...

This what you mean?

Scrollbars_ChildTest.au3

:shocked:

hey gafrost awesome script, i couldnt find anything else suitable for a MDI interface.

i was wondering how do you tell which child window is active/clicked, so i can close that instead of whole script, also how can i hide/remove the scrollbars from the child windows??

#include <GUIConstants.au3>
Opt("MustDeclareVars", 1)

; need these as global for the functions
; for main gui
Global $m_width = 400, $m_height = 400
; child gui
Global $c_width = 200, $c_height = 200, $c_left = 215, $c_top = 200
; no child gui or no controls exceeding the width/height of the window
;~ Global $c_width = 0, $c_height = 0, $c_left = 0, $c_top = 0

#include <GUIScrollBars.au3>


_Main()

Func _Main()
    Local $nFileMenu, $nExititem, $GUIMsg, $hGUI, $h_cGUI, $h_cGUI2
    Local $listview, $button, $button2

    GUIRegisterMsg($WM_CREATE, "MY_WM_CREATE")
    GUIRegisterMsg($WM_SIZE, "MY_WM_SIZE")

    $hGUI = GUICreate("My GUI", 500, 500, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_MAXIMIZEBOX))
    GUISetBkColor(0x88AABB)
    $nFileMenu = GUICtrlCreateMenu("File")
    $nExititem = GUICtrlCreateMenuitem("Exit", $nFileMenu)
     
    GUIRegisterMsg($WM_CREATE, "MY_WM_CREATE")
     
    $h_cGUI = GUICreate("Child GUI 1", $m_width, $m_height, 0, 0, BitOR($WS_CAPTION,$WS_CHILD,$WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_MAXIMIZEBOX,$WS_HSCROLL,$WS_VSCROLL) , $WS_EX_CLIENTEDGE, $hGUI)
    GUISetBkColor(0X006400)
    $listview = GUICtrlCreateListView("col1  |col2|col3  ", 10, 10, 200, 150);,$LVS_SORTDESCENDING)
    $button = GUICtrlCreateButton("Value?", 75, 170, 70, 20)
    For $x = 1 To 30
        GUICtrlCreateListViewItem("item" & $x & "|col2|col3", $listview)
    Next
    GUISetState(@SW_SHOW, $h_cGUI)

    GUISwitch($hGUI)

    GUIRegisterMsg($WM_CREATE, "MY_WM_CREATE")
     
    $h_cGUI2 = GUICreate("Child GUI 2", $c_width, $c_height, $c_left, 10, BitOR($WS_CAPTION,$WS_CHILD,$WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_MAXIMIZEBOX), $WS_EX_CLIENTEDGE, $hGUI)
    $button2 = GUICtrlCreateButton("Value?", 75, 170, 70, 20)
    GUISetBkColor(0x88AABB)
    GUISetState(@SW_SHOW, $h_cGUI2)

;;hide the scrollbars on the child windows how??
    GUISwitch($hGUI)

    ;GUIRegisterMsg($WM_VSCROLL, "MY_WM_VSCROLL")
   ; GUIRegisterMsg($WM_HSCROLL, "MY_WM_HSCROLL")
    GUISetState(@SW_SHOW, $hGUI)
;~     Local $RangeMinMax = _GetScrollRange($h_cGUI, $SB_VERT)
;~     ConsoleWrite("Vert Min/Max: " & $RangeMinMax[0] & "/" & $RangeMinMax[1] & @LF)
;~     $RangeMinMax = _GetScrollRange($h_cGUI, $SB_HORZ)
;~     ConsoleWrite("Horz Min/Max: " & $RangeMinMax[0] & "/" & $RangeMinMax[1] & @LF)

    While 1
        $GUIMsg = GUIGetMsg()

        Switch $GUIMsg
            Case $GUI_EVENT_CLOSE, $nExititem
                ;close which window that the user clicked on, how do you tell??t
        
                If WinGetHandle('') = $hGUI Then
                    ExitLoop
                Else
                    GUIDelete(WinGetHandle(''))
                EndIf
        EndSwitch
    WEnd

    Exit
EndFunc   ;==>_Main
Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

  • 2 weeks later...

Hi!

In this topic was an example, when regedit is inside gui window. Help me: why i can not place inside my window Winamp 2.7? How i can do this?

No there wasn't.

Don't know try, support part of the forum.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

No there wasn't.

Don't know try, support part of the forum.

A man of many words :shocked: ... Unlike his wife :(

Good job gafrost! Looks great. I'll test it a bit later... after sleep :P

Link to comment
Share on other sites

Very nice job, opens up a lot more desktop space, and removed the need for multiple GUI's. Thanks!

http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script]
Link to comment
Share on other sites

  • 2 months later...

This what you mean?

Scrollbars_ChildTest.au3

:whistle:

This only works for me until I start moving Child 2 around and then the scrollbars in Child Gui1 might freeze and the scrollbars in Child GUi2 freeze, and sometimes I can drag Child Gui 2 sometimes I can't. Using the scroll bars in the main Gui might or might not start the other scrollbars working. When I can move Child 2 and part of it goes behind the list view then it is not redrawn correctly, ie it is dragged around with a copy of the overlapping listview on it or a bit of the button on it.

With the Scrollbars_Test.au3 the scrollbars change in size. When the script first runs the thumbs are about 50% of the window, and if I use the scrollbars at this stage then lots of things go wrong. The scrolbars might disappear for a while and move by themselves. Once the thumbs have changed size to be quite small then it all seems more stable.

This if with Autoit Beta 3.2.3.14, and XP SP1. Since no-one else seems to have problems do you think it's SP1? (SP2 hangs on my PC)

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

  • 4 weeks later...

I am trying to create a GUI that displays an image within a child GUI with a vertical scrollbar. The image is often taller than the screen size so needs to be able to scroll.

I have tried using gafrosts code, and it mostly works (Thanks!) , the only problem I am still having is trying to figure out what to set the scroll range to in order that all the image is visible but not to have a lot of white space at the bottom of the image.

Does anyone know how to calculate what the to set the scroll range to.

e.g.

If the child GUI is 400 high by 300 wide and the image is 550 high by 300 wide.

What parameters should I use for _InitScrollDimensions? Does this depend on the placement of the child GUI within the main GUI?

Or should I use _SetScrollRange?

Thanks for any assistance with this.

Code below:

The code is a bit of a mess currently.... but if anyone else is doing something similar this my be of use.

CODE
#include <GUIConstants.au3>

#include <Array.au3>

#include <GUIScrollBars.au3>

#include <File.au3>

#include <FileGetExtProp.au3>

Opt ("TrayIconHide",1)

Opt ("WinTitleMatchMode", 4)

$ButtonHPadding = 20

$ButtonVPaddingBelow = 10

$ButtonVPaddingAbove = 5

$ButtonHeight = 24

$ScrollbarWidth=16

$IntranetServer="http://your.intranet.server.com/"

$NotifyFilename="today.gif"

$NotifyFileServerLocation= $IntranetServer&$NotifyFilename

$IntranetButtonLabel="&Lanch our Intranet"

$TaskbarPosSize=WinGetPos("classname=Shell_TrayWnd")

;Find where and how big the task bar is so we don't overlap with it.

Select

Case $TaskbarPosSize[3]=@DesktopHeight ; Taskbar is vertical, so we can use the full height

$WindowPaddingAbove = 4 ; allow just a few pixels padding.

$WindowPaddingBelow = 4 ; allow just a few pixels padding.

Case $TaskbarPosSize[1]=0 ;Taskbar is at the top

$WindowPaddingAbove=$TaskbarPosSize[3]+4

$WindowPaddingBelow = 4

Case Else ; Not at the top or side, assume it's at the bottom.

$WindowPaddingAbove=4

$WindowPaddingBelow =$TaskbarPosSize[3]+4

EndSelect

;find out how big the window border and the title bar are for calculations of the window size

Const $SM_CYCAPTION=4

Const $SM_CXFIXEDFRAME=7

$wtit=DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CYCAPTION)

$height_titlebar=$wtit[0]; 19 or 26

$border=DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CXFIXEDFRAME)

$window_border_size=$border[0]; 3

;calculate how much space to leave around various parts of the GUI

$VerticalWindowPadding=$WindowPaddingAbove+$WindowPaddingBelow

$NotifyButtonPadding=$ButtonVPaddingAbove + $ButtonVPaddingBelow + $ButtonHeight

$NotifyVerticalPadding = $NotifyButtonPadding+$height_titlebar+$window_border_size

;download the file to a temp location. File must have an image file extension otherwise the function _FileGetExtProp fails.

$TodayGIFFile=_TempFile()&$NotifyFilename

InetGet($NotifyFileServerLocation, $TodayGIFFile)

;Find how big the image is

$TodayGifDimensions = _FileGetExtProp($TodayGIFFile, 26)

$TodayGifDimensionsArray = StringSplit ($TodayGifDimensions, " x ", 1)

If $TodayGifDimensionsArray[0]<>2 Then ; file is not a gif file, possibly it is a http error or there is no file

MsgBox(0,"Intranet Notify Error","Intranet Notify was unable to connect to the Intranet Server.")

FileDelete($TodayGIFFile)

Exit

Else

$TodayGifWidth=$TodayGifDimensionsArray[1]

$TodayGifHeight=$TodayGifDimensionsArray[2]

EndIf

$NotifyGUIHeight = $TodayGifHeight+ $NotifyVerticalPadding

$UseableSpace=@DesktopHeight-$VerticalWindowPadding

If ($NotifyGUIHeight > $UseableSpace) Then; Image is bigger than the usable screen size.

$Scrolling=True

$NotifyGUIWidth = $TodayGifWidth+$ScrollbarWidth ; add some space for the scroll bar

$NotifyGUIInternalHeight= @DesktopHeight-$VerticalWindowPadding-$height_titlebar-$window_border_size ; use all available height

$NotifyPicGUIHeight=$NotifyGUIInternalHeight - $NotifyButtonPadding

Else ;Entire GUI will fix, no scrolling needed. Hurrah!

$NotifyGUIInternalHeight= $TodayGifHeight+$NotifyButtonPadding

$Scrolling=False

$NotifyGUIWidth = $TodayGifWidth

$NotifyPicGUIHeight=$TodayGifHeight

EndIf

;Create the parent GUI with the two buttons.

GUIRegisterMsg($WM_CREATE, "MY_WM_CREATE")

GUIRegisterMsg($WM_SIZE, "MY_WM_SIZE")

$NotifyGUI= GUICreate("Today's News on the Intranet",$NotifyGUIWidth,$NotifyGUIInternalHeight,-1,-1,BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU))

GUISetBkColor (0xFFFFFF)

GUISwitch($NotifyGUI)

$ButtonVerticalPlacement=$NotifyGUIInternalHeight-$ButtonVPaddingBelow-$ButtonHeight

$ButtonWidth=($TodayGifWidth-(3*$ButtonHPadding))/2

$LaunchIntranet = GUICtrlCreateButton ($IntranetButtonLabel , $ButtonHPadding, $ButtonVerticalPlacement,$ButtonWidth,$ButtonHeight)

$GoToWindows = GUICtrlCreateButton ( "&Close", $ButtonWidth+(2*$ButtonHPadding), $ButtonVerticalPlacement,$ButtonWidth,$ButtonHeight)

GUISetState()

;Create a child GUI just for the image. This GUI may need to scroll.

GUIRegisterMsg($WM_CREATE, "MY_WM_CREATE")

$NotifyPicGUI = GUICreate("NotifyPicGUI", $NotifyGUIWidth, $NotifyPicGUIHeight, 0, 0, $WS_CHILD,-1,$NotifyGUI)

GUISetBkColor (0xFFFFFF)

$NotifyPic = GuiCtrlCreatePic($TodayGIFFile,0,0,$TodayGifWidth,$TodayGifHeight)

GUISetState()

FileDelete($TodayGIFFile)

If $Scrolling Then

_InitScrollDimensions($NotifyGUIWidth,$NotifyGUIHeight,$NotifyGUIWidth,$TodayGIFHeight,0,0)

GUIRegisterMsg($WM_VSCROLL, "MY_WM_VSCROLL")

GUIRegisterMsg($WM_HSCROLL, "MY_WM_HSCROLL")

_ShowScrollBar ($NotifyPicGUI, $SB_VERT,True)

_EnableScrollBar($NotifyPicGUI, $SB_VERT,True)

_EnableScrollBar($NotifyPicGUI, $SB_HORZ, False)

_ShowScrollBar ($NotifyPicGUI, $SB_HORZ,False)

EndIf

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $LaunchIntranet

If NOT FileExists('C:\Program Files\Internet Explorer\iexplore.exe') Then

MsgBox(0,"Intranet Notify Error","The Internet Explorer executable is missing from C:\Program Files\Internet Explorer\")

ExitLoop

EndIf

Run('C:\Program Files\Internet Explorer\iexplore.exe -new ' & $IntranetServer)

ExitLoop

Case $msg = $GoToWindows

ExitLoop

EndSelect

Wend

Link to comment
Share on other sites

  • 4 weeks later...

Hello! I'm trying to remove the "$nFileMenu = GUICtrlCreateMenu("File")" tag from the GUI, but when i do so, it renders the scroll bar usless. any suggestions?

#include <GUIConstants.au3>
#include <GUIScrollBars.au3>

Global $m_width = 600, $m_height = 600

_Main()

Func _Main()
    Local $nFileMenu, $nExititem, $GUIMsg, $hGUI, $h_cGUI, $h_cGUI2
    Local $listview, $button, $button2

    GUIRegisterMsg($WM_CREATE, "MY_WM_CREATE")
    GUIRegisterMsg($WM_SIZE, "MY_WM_SIZE")

    $hGUI = GUICreate("My GUI", 330, 390, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
    GUISetBkColor(0x88AABB)
    
    $nFileMenu = GUICtrlCreateMenu("File")
    
    $Label2 = GUICtrlCreateLabel("ALabel2", 168, 600, 43, 17)
    $Label1 = GUICtrlCreateLabel("ALabel1", 104, 56, 43, 17)
    
    GUISwitch($hGUI)
    
    GUIRegisterMsg($WM_VSCROLL, "MY_WM_VSCROLL")
    GUIRegisterMsg($WM_HSCROLL, "MY_WM_HSCROLL")
    
    GUISetState(@SW_SHOW, $hGUI)
   
    While 1
        $GUIMsg = GUIGetMsg()

        Switch $GUIMsg
            Case $GUI_EVENT_CLOSE;, $nExititem
                ExitLoop
        EndSwitch
    WEnd
    
    Exit
EndFunc
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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