Melba23

Scrollbars Made Easy - New version 16 Feb 17

166 posts in this topic




I was looking at something like this a couple of days back and found this (a post by you) and now you release this, awesome! Thanks.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Very good, but if i am a “less experienced user”, then i will have a difficulties to save all these scripts to correct files and make it work. Why you guys don't post an attached zip-file with all needed UDFs/Examples, so lazy users as my self could just download the archive, unpack it and check the great stuff you have there :idea:


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

MrCreatoR,

post an attached zip-file

Done - see first post. :idea:

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

Done - see first post

Thank you!

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Hi,

I realised that there was not a really simple example to show how easy GUIScrollbars_Ex is to use - so here it is:

#include <GUIConstantsEx.au3>
#include <GUIScrollbars_Ex.au3>

; Create GUI with red background
$hGUI = GUICreate("Test", 500, 500)
GUISetBkColor(0xFF0000, $hGUI)

; Create a 1000x1000 green label
GUICtrlCreateLabel("", 0, 0, 1000, 1000)
GUICtrlSetBkColor(-1, 0x00FF00)

GUISetState()

; Generate scrollbars - yes this is all you have to do!!!!!!!!!!!!!!
_GUIScrollbars_Generate($hGUI, 1000, 1000)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

I have added it to the zip above and amended the first post. :idea:

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

I realised that there was not a really simple example to show how easy GUIScrollbars_Ex is to use - so here it is:

Nice, but i think that you can make more usefull example. Many users need the scrollable GUI for the settings window, so this window could include more options in one place (reachable by the scroll).

Here is the example:

#include <GUIConstantsEx.au3>
#include <GUIScrollbars_Ex.au3>

; Create GUI
$hGUI = GUICreate("_GUIScrollbars_Generate Demo", 500, 500)

$iTop = 20

For $i = 1 To 100
    GUICtrlCreateCheckbox("Option " & $i & "-a", 20, $iTop)
    GUICtrlCreateCheckbox("Option " & $i & "-b", 500, $iTop)
    
    $iTop += 20
Next

; Generate scrollbars
_GUIScrollbars_Generate($hGUI, 600, $iTop)

GUISetState()

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

P.S

I have one small(?) feature request: Add an ability to scroll the window by mouse wheel.


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

MrCreatoR,

Add an ability to scroll the window by mouse wheel

I have never been able to get my mouse to scroll an AutoIt scrollbar. And yes I have tried your MouseOnEvent UDF. :idea: Everything works except the scroll wheel.

So if you would like to work at it, be my guest. :)

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 Melba,

I'm drawing custom window, at least the title bar is custom. However I'm unable to make the scrollbars ignore the top region and only scroll an area beneath it.

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
#include <Constants.au3>
#include <WinApi.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

#include "../GUIScrollbars_Size.au3"


Global Const $SC_DRAGMOVE = 0xF012
Opt("MouseCoordMode", 2)

Local $tMsg
Opt("TrayMenuMode", 1)

$frmMain = GUICreate("frmMain", 333, 441, -1, -1, $WS_POPUP, 0)
GUISetState(@SW_SHOW)
GUISetBkColor(0xe9eff5, $frmMain)

; Scrollbars
$aRet = _GUIScrollbars_Size(0, 500, 1, 441)
GUIRegisterMsg($WM_VSCROLL, "_Scrollbars_WM_VSCROLL")

_GUIScrollBars_Init($frmMain)
_GUIScrollBars_ShowScrollBar($frmMain, $SB_VERT, True)
_GUIScrollBars_ShowScrollBar($frmMain, $SB_HORZ, False)
_GUIScrollBars_SetScrollInfoPage($frmMain, $SB_VERT, $aRet[2])
_GUIScrollBars_SetScrollInfoMax($frmMain, $SB_VERT, $aRet[3])

$rgn = _WinAPI_CreateRoundRectRgn(0, 0, 333, 441, 3, 3)
_WinAPI_SetWindowRgn($frmMain, $rgn)
DrawBar()

While 1
    $tMsg = TrayGetMsg()
    Switch $tMsg
        Case $TRAY_EVENT_PRIMARYDOWN
            GUISetState(@SW_SHOW)
            DrawBar()
            WinSetState("frmMain", "", @SW_RESTORE)
            Opt("TrayIconHide", 1)
    EndSwitch

    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_PRIMARYDOWN
            $mPos = MouseGetPos()
            If $mPos[1] <= 20 Then
                If $mPos[0] >= 295 And $mPos[0] <= 316 Then
                    GUISetState(@SW_HIDE)
                    Opt("TrayIconHide", 0)
                ElseIf $mPos[0] >= 313 And $mPos[0] <= 322 Then
                    Exit
                Else
                    _SendMessage($frmMain, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
                EndIf
            EndIf
    EndSwitch
WEnd

Func DrawBar()
    Local $aDim = WinGetClientSize($frmMain)
    Local $hDC = _WinAPI_GetDC($frmMain)
    ; Bar
    Local $hBrush = _WinAPI_CreateSolidBrush(0xf5d997) ; 0x97d9f5
    Local $hRect = DllStructCreate($tagRECT)
    DllStructSetData($hRect, "Left", 0)
    DllStructSetData($hRect, "Top", 0)
    DllStructSetData($hRect, "Right", $aDim[0])
    DllStructSetData($hRect, "Bottom", 20)
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    _WinAPI_DeleteObject($hBrush)
    ; Bar text
    Local $sTitle = WinGetTitle($frmMain)
    Local $hBrush = _WinAPI_CreateSolidBrush(0x000000) ; 0xe9eff5
    DllStructSetData($hRect, "Left", 4)
    DllStructSetData($hRect, "Top", 2)
    DllStructSetData($hRect, "Right", $aDim[0] - 40)
    DllStructSetData($hRect, "Bottom", 20)
    _WinAPI_SetBkMode($hDC, $TRANSPARENT)
    _WinAPI_SetTextColor($hDC, 0xFFFFFF)
    _WinAPI_DrawText($hDC, $sTitle, $hRect, $DT_LEFT)
    _WinAPI_DeleteObject($hBrush)
    ; Minimize
    $hBrush = _WinAPI_CreateSolidBrush(0x000000)
    DllStructSetData($hRect, "Left", $aDim[0] - 37)
    DllStructSetData($hRect, "Top", 12)
    DllStructSetData($hRect, "Right", $aDim[0] - 28)
    DllStructSetData($hRect, "Bottom", 14)
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    _WinAPI_DeleteObject($hBrush)
    ; Close
    Local $hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0x000000)
    Local $hSelected = _WinAPI_SelectObject($hDC, $hPen)
    _WinAPI_DrawLine($hDC, $aDim[0] - 20, 5, $aDim[0] - 11, 14)
    _WinAPI_DrawLine($hDC, $aDim[0] - 20, 14, $aDim[0] - 11, 5)
    _WinAPI_SelectObject($hDC, $hSelected)
    _WinAPI_DeleteObject($hPen)
    $hBrush = _WinAPI_CreateSolidBrush(0xd8ded3)
    ; Frame Edge
    ;$hBrush = _WinAPI_CreateSolidBrush(0x000000)
    DllStructSetData($hRect, "Left", 0)
    DllStructSetData($hRect, "Top", 20)
    DllStructSetData($hRect, "Right", 1)
    DllStructSetData($hRect, "Bottom", 1)
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    DllStructSetData($hRect, "Left", $aDim[0] - 2)
    DllStructSetData($hRect, "Top", 20)
    DllStructSetData($hRect, "Right", $aDim[0])
    DllStructSetData($hRect, "Bottom", $aDim[1])
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    DllStructSetData($hRect, "Left", 0)
    DllStructSetData($hRect, "Top", 20)
    DllStructSetData($hRect, "Right", 1)
    DllStructSetData($hRect, "Bottom", $aDim[1])
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    DllStructSetData($hRect, "Left", 0)
    DllStructSetData($hRect, "Top", $aDim[1] - 2)
    DllStructSetData($hRect, "Right", $aDim[0])
    DllStructSetData($hRect, "Bottom", $aDim[1])
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    _WinAPI_DeleteObject($hBrush)
    _WinAPI_ReleaseDC($frmMain, $hDC)
    AdlibRegister("DrawBar")
EndFunc   ;==>DrawBar

Func _Scrollbars_WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)

    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $iIndex = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $iIndex = $x
            $yChar = $aSB_WindowInfo[$iIndex][3]
            ExitLoop
        EndIf
    Next
    If $iIndex = -1 Then Return 0

    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP
            DllStructSetData($tSCROLLINFO, "nPos", $Min)
        Case $SB_BOTTOM
            DllStructSetData($tSCROLLINFO, "nPos", $Max)
        Case $SB_LINEUP
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
        Case $SB_LINEDOWN
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
        Case $SB_PAGEUP
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
        Case $SB_PAGEDOWN
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
        Case $SB_THUMBTRACK
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_Scrollbars_WM_VSCROLL

James

Share this post


Link to post
Share on other sites

james,

As far as I know Windows draws the scrollbars to fill the client area - which is what is happening here. :)

However, nothing is impossible: :(

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
#include <Constants.au3>
#include <WinApi.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

#include <GUIScrollbars_Size.au3>


Global Const $SC_DRAGMOVE = 0xF012
Opt("MouseCoordMode", 2)

Local $tMsg
Opt("TrayMenuMode", 1)

$frmMain = GUICreate("frmMain", 333, 421, -1, -1, $WS_POPUP, 0)
GUISetState(@SW_SHOW)
GUISetBkColor(0xe9eff5, $frmMain)

$frmBar = GUICreate("frmBar", 333, 20, -1, -1, $WS_POPUP, 0)
GUISetState(@SW_SHOW)

$aPos = WinGetPos($frmMain)
WinMove($frmBar, "", $aPos[0], $aPos[1] - 20)

GUIRegisterMsg($WM_MOVE, "StickTogether")

; Scrollbars
$aRet = _GUIScrollbars_Size(0, 500, 1, 441)
GUIRegisterMsg($WM_VSCROLL, "_Scrollbars_WM_VSCROLL")

_GUIScrollBars_Init($frmMain)
_GUIScrollBars_ShowScrollBar($frmMain, $SB_VERT, True)
_GUIScrollBars_ShowScrollBar($frmMain, $SB_HORZ, False)
_GUIScrollBars_SetScrollInfoPage($frmMain, $SB_VERT, $aRet[2])
_GUIScrollBars_SetScrollInfoMax($frmMain, $SB_VERT, $aRet[3])

$rgn = _WinAPI_CreateRoundRectRgn(0, 0, 333, 441, 3, 3)
_WinAPI_SetWindowRgn($frmMain, $rgn)
DrawBar()

While 1
    $tMsg = TrayGetMsg()
    Switch $tMsg
        Case $TRAY_EVENT_PRIMARYDOWN
            GUISetState(@SW_SHOW)
            DrawBar()
            WinSetState("frmMain", "", @SW_RESTORE)
            Opt("TrayIconHide", 1)
    EndSwitch

    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_PRIMARYDOWN
            $mPos = MouseGetPos()
            If $mPos[1] <= 20 Then
                If $mPos[0] >= 295 And $mPos[0] <= 316 Then
                    GUISetState(@SW_HIDE)
                    Opt("TrayIconHide", 0)
                ElseIf $mPos[0] >= 313 And $mPos[0] <= 322 Then
                    Exit
                Else
                    _SendMessage($frmBar, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
                EndIf
            EndIf
    EndSwitch
WEnd

Func StickTogether($hWnd, $iMsg, $wParam, $lParam)

    #forceref $iMsg, $wParam, $lParam

    Switch $hWnd
        Case $frmBar
            Local $aPos = WinGetPos($frmBar)
            WinMove($frmMain, "", $aPos[0], $aPos[1] + 20)
    EndSwitch

EndFunc

Func DrawBar()
    Local $aDim = WinGetClientSize($frmBar)
    Local $hDC = _WinAPI_GetDC($frmBar)
    ; Bar
    Local $hBrush = _WinAPI_CreateSolidBrush(0xf5d997) ; 0x97d9f5
    Local $hRect = DllStructCreate($tagRECT)
    DllStructSetData($hRect, "Left", 0)
    DllStructSetData($hRect, "Top", 0)
    DllStructSetData($hRect, "Right", $aDim[0])
    DllStructSetData($hRect, "Bottom", 20)
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    _WinAPI_DeleteObject($hBrush)
    ; Bar text
    Local $sTitle = WinGetTitle($frmBar)
    Local $hBrush = _WinAPI_CreateSolidBrush(0x000000) ; 0xe9eff5
    DllStructSetData($hRect, "Left", 4)
    DllStructSetData($hRect, "Top", 2)
    DllStructSetData($hRect, "Right", $aDim[0] - 40)
    DllStructSetData($hRect, "Bottom", 20)
    _WinAPI_SetBkMode($hDC, $TRANSPARENT)
    _WinAPI_SetTextColor($hDC, 0xFFFFFF)
    _WinAPI_DrawText($hDC, $sTitle, $hRect, $DT_LEFT)
    _WinAPI_DeleteObject($hBrush)
    ; Minimize
    $hBrush = _WinAPI_CreateSolidBrush(0x000000)
    DllStructSetData($hRect, "Left", $aDim[0] - 37)
    DllStructSetData($hRect, "Top", 12)
    DllStructSetData($hRect, "Right", $aDim[0] - 28)
    DllStructSetData($hRect, "Bottom", 14)
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    _WinAPI_DeleteObject($hBrush)
    ; Close
    Local $hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0x000000)
    Local $hSelected = _WinAPI_SelectObject($hDC, $hPen)
    _WinAPI_DrawLine($hDC, $aDim[0] - 20, 5, $aDim[0] - 11, 14)
    _WinAPI_DrawLine($hDC, $aDim[0] - 20, 14, $aDim[0] - 11, 5)
    _WinAPI_SelectObject($hDC, $hSelected)
    _WinAPI_DeleteObject($hPen)
    $hBrush = _WinAPI_CreateSolidBrush(0xd8ded3)
    ; Frame Edge
    ;$hBrush = _WinAPI_CreateSolidBrush(0x000000)
    DllStructSetData($hRect, "Left", 0)
    DllStructSetData($hRect, "Top", 20)
    DllStructSetData($hRect, "Right", 1)
    DllStructSetData($hRect, "Bottom", 1)
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    DllStructSetData($hRect, "Left", $aDim[0] - 2)
    DllStructSetData($hRect, "Top", 20)
    DllStructSetData($hRect, "Right", $aDim[0])
    DllStructSetData($hRect, "Bottom", $aDim[1])
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    DllStructSetData($hRect, "Left", 0)
    DllStructSetData($hRect, "Top", 20)
    DllStructSetData($hRect, "Right", 1)
    DllStructSetData($hRect, "Bottom", $aDim[1])
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    DllStructSetData($hRect, "Left", 0)
    DllStructSetData($hRect, "Top", $aDim[1] - 2)
    DllStructSetData($hRect, "Right", $aDim[0])
    DllStructSetData($hRect, "Bottom", $aDim[1])
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    _WinAPI_DeleteObject($hBrush)
    _WinAPI_ReleaseDC($frmBar, $hDC)
    AdlibRegister("DrawBar")
EndFunc   ;==>DrawBar

Func _Scrollbars_WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)

    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $iIndex = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $iIndex = $x
            $yChar = $aSB_WindowInfo[$iIndex][3]
            ExitLoop
        EndIf
    Next
    If $iIndex = -1 Then Return 0

    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP
            DllStructSetData($tSCROLLINFO, "nPos", $Min)
        Case $SB_BOTTOM
            DllStructSetData($tSCROLLINFO, "nPos", $Max)
        Case $SB_LINEUP
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
        Case $SB_LINEDOWN
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
        Case $SB_PAGEUP
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
        Case $SB_PAGEDOWN
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
        Case $SB_THUMBTRACK
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_Scrollbars_WM_VSCROLL

You work out how I did it! :idea:

M23

P.S. There is some work to do still, I have only done the bare minimum. After all it is nothing to do with my UDF! :)


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

James,

"dirty"? :idea:

"Inspired lateral thinking" would be my preferred comment! :)

M23

1 person likes this

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

Any reason not to make the content window an MDI child (WS_EX_MDICHILD)? Then moving the window takes care of itself. Here's an example. You might have to play with the window placement slightly, but it looks pretty good.

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
#include <Constants.au3>
#include <WinApi.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

#include <GUIScrollbars_Size.au3>


Global Const $SC_DRAGMOVE = 0xF012
Opt("MouseCoordMode", 2)

Local $tMsg
Opt("TrayMenuMode", 1)

$frmBar = GUICreate("frmBar", 333, 441, -1, -1, $WS_POPUP, 0)
GUISetState(@SW_SHOW)

$frmMain = GUICreate("frmMain", 333, 421, 4, 24, $WS_POPUP, $WS_EX_MDICHILD, $frmBar)
GUISetState(@SW_SHOW)

; Scrollbars
$aRet = _GUIScrollbars_Size(0, 500, 1, 441)
GUIRegisterMsg($WM_VSCROLL, "_Scrollbars_WM_VSCROLL")

_GUIScrollBars_Init($frmMain)
_GUIScrollBars_ShowScrollBar($frmMain, $SB_VERT, True)
_GUIScrollBars_ShowScrollBar($frmMain, $SB_HORZ, False)
_GUIScrollBars_SetScrollInfoPage($frmMain, $SB_VERT, $aRet[2])
_GUIScrollBars_SetScrollInfoMax($frmMain, $SB_VERT, $aRet[3])

$rgn = _WinAPI_CreateRoundRectRgn(0, 0, 333, 441, 3, 3)
_WinAPI_SetWindowRgn($frmMain, $rgn)
DrawBar()

While 1
    $tMsg = TrayGetMsg()
    Switch $tMsg
        Case $TRAY_EVENT_PRIMARYDOWN
            GUISetState(@SW_SHOW, $frmBar)
            GUISetState(@SW_SHOW, $frmMain)
            WinActivate($frmBar)
            DrawBar()
            Opt("TrayIconHide", 1)
    EndSwitch

    $nMsg = GUIGetMsg(1)
    Switch $nMsg[1] ; window
        Case $frmBar
            Switch $nMsg[0] ; event ID
                Case $GUI_EVENT_CLOSE
                    Exit
                Case $GUI_EVENT_PRIMARYDOWN
                    If $nMsg[4] <= 20 Then
                        If $nMsg[3] >= 295 And $nMsg[3] <= 316 Then
                            GUISetState(@SW_HIDE, $frmMain)
                            GUISetState(@SW_HIDE, $frmBar)
                            Opt("TrayIconHide", 0)
                        ElseIf $nMsg[3] >= 313 And $nMsg[3] <= 322 Then
                            Exit
                        Else
                            _SendMessage($frmBar, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
                        EndIf
                    EndIf
            EndSwitch
    EndSwitch
WEnd

Func DrawBar()
    Local $aDim = WinGetClientSize($frmBar)
    Local $hDC = _WinAPI_GetDC($frmBar)
    ; Bar
    Local $hBrush = _WinAPI_CreateSolidBrush(0xf5d997) ; 0x97d9f5
    Local $hRect = DllStructCreate($tagRECT)
    DllStructSetData($hRect, "Left", 0)
    DllStructSetData($hRect, "Top", 0)
    DllStructSetData($hRect, "Right", $aDim[0])
    DllStructSetData($hRect, "Bottom", 20)
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    _WinAPI_DeleteObject($hBrush)
    ; Bar text
    Local $sTitle = WinGetTitle($frmBar)
    Local $hBrush = _WinAPI_CreateSolidBrush(0x000000) ; 0xe9eff5
    DllStructSetData($hRect, "Left", 4)
    DllStructSetData($hRect, "Top", 2)
    DllStructSetData($hRect, "Right", $aDim[0] - 40)
    DllStructSetData($hRect, "Bottom", 20)
    _WinAPI_SetBkMode($hDC, $TRANSPARENT)
    _WinAPI_SetTextColor($hDC, 0xFFFFFF)
    _WinAPI_DrawText($hDC, $sTitle, $hRect, $DT_LEFT)
    _WinAPI_DeleteObject($hBrush)
    ; Minimize
    $hBrush = _WinAPI_CreateSolidBrush(0x000000)
    DllStructSetData($hRect, "Left", $aDim[0] - 37)
    DllStructSetData($hRect, "Top", 12)
    DllStructSetData($hRect, "Right", $aDim[0] - 28)
    DllStructSetData($hRect, "Bottom", 14)
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    _WinAPI_DeleteObject($hBrush)
    ; Close
    Local $hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0x000000)
    Local $hSelected = _WinAPI_SelectObject($hDC, $hPen)
    _WinAPI_DrawLine($hDC, $aDim[0] - 20, 5, $aDim[0] - 11, 14)
    _WinAPI_DrawLine($hDC, $aDim[0] - 20, 14, $aDim[0] - 11, 5)
    _WinAPI_SelectObject($hDC, $hSelected)
    _WinAPI_DeleteObject($hPen)
    $hBrush = _WinAPI_CreateSolidBrush(0xd8ded3)
    ; Frame Edge
    ;$hBrush = _WinAPI_CreateSolidBrush(0x000000)
    DllStructSetData($hRect, "Left", 0)
    DllStructSetData($hRect, "Top", 20)
    DllStructSetData($hRect, "Right", 1)
    DllStructSetData($hRect, "Bottom", 1)
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    DllStructSetData($hRect, "Left", $aDim[0] - 2)
    DllStructSetData($hRect, "Top", 20)
    DllStructSetData($hRect, "Right", $aDim[0])
    DllStructSetData($hRect, "Bottom", $aDim[1])
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    DllStructSetData($hRect, "Left", 0)
    DllStructSetData($hRect, "Top", 20)
    DllStructSetData($hRect, "Right", 1)
    DllStructSetData($hRect, "Bottom", $aDim[1])
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    DllStructSetData($hRect, "Left", 0)
    DllStructSetData($hRect, "Top", $aDim[1] - 2)
    DllStructSetData($hRect, "Right", $aDim[0])
    DllStructSetData($hRect, "Bottom", $aDim[1])
    _WinAPI_FillRect($hDC, DllStructGetPtr($hRect), $hBrush)
    _WinAPI_DeleteObject($hBrush)
    _WinAPI_ReleaseDC($frmBar, $hDC)
    AdlibRegister("DrawBar")
EndFunc   ;==>DrawBar

Func _Scrollbars_WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)

    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $iIndex = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $iIndex = $x
            $yChar = $aSB_WindowInfo[$iIndex][3]
            ExitLoop
        EndIf
    Next
    If $iIndex = -1 Then Return 0

    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP
            DllStructSetData($tSCROLLINFO, "nPos", $Min)
        Case $SB_BOTTOM
            DllStructSetData($tSCROLLINFO, "nPos", $Max)
        Case $SB_LINEUP
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
        Case $SB_LINEDOWN
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
        Case $SB_PAGEUP
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
        Case $SB_PAGEDOWN
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
        Case $SB_THUMBTRACK
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_Scrollbars_WM_VSCROLL

Share this post


Link to post
Share on other sites

wraithdu,

I like a multi-brain solution to a problem! :idea:

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

Posted Image

Two windows, one for title bar and one for client area? What were you inspired by, crack? :idea:

James

One of my favorite tricks for solving many GUI problems is to use multiple windows. It can save me having to create multiple controls for example and in some cases I even change the text for a button when a window is shown and then change it back when that Window is hidden and the original Child restored.

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

MrCreatoR,

I have never been able to get my mouse to scroll an AutoIt scrollbar. And yes I have tried your MouseOnEvent UDF. :idea: Everything works except the scroll wheel.

So if you would like to work at it, be my guest. :)

M23

It's easy, you just add this to the UDF:

#include <SendMessage.au3>

....

GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL")

....

Func WM_MOUSEWHEEL($hWnd, $nMsg, $wParam, $lParam)
    Local $nKeys = BitAnd($wParam, 0x0000FFFF)
    Local $nDistance = BitShift($wParam, 16)
    
    If $nDistance > 0 Then
        _SendMessage($hWnd, $WM_VSCROLL, $SB_LINEUP, 0)
    Else
        _SendMessage($hWnd, $WM_VSCROLL, $SB_LINEDOWN, 0)
    EndIf
EndFunc

At least for the vertical scroll this is usefull.


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#20 ·  Posted

And this one will enable the horizontal scroll by holding Shift or Ctrl key:

Func _Scrollbars_WM_MOUSEWHEEL($hWnd, $nMsg, $wParam, $lParam)
    Local $nKeys = BitAND($wParam, 0x0000FFFF)
    Local $nDistance = BitShift($wParam, 16)
    
    If $nKeys = 0 Then
        If $nDistance > 0 Then
            _SendMessage($hWnd, $WM_VSCROLL, $SB_LINEUP, 0)
        Else
            _SendMessage($hWnd, $WM_VSCROLL, $SB_LINEDOWN, 0)
        EndIf
    Else
        If $nDistance > 0 Then
            _SendMessage($hWnd, $WM_HSCROLL, $SB_LINELEFT, 0)
        Else
            _SendMessage($hWnd, $WM_HSCROLL, $SB_LINERIGHT, 0)
        EndIf
    EndIf
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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