Sign in to follow this  
Followers 0
MyEarth

[VB] Sizing grips in Autoit

11 posts in this topic

#1 ·  Posted (edited)

Hi,

I don't know how is called ( EDIT: sizing grips ) so i'll make a screenshot:

25h3ewz.jpg

With Autoit Window Info is msctls_statusbar32, also SciTEWindow have it. But i see it also in a third-part software:

24qu99f.jpg

In this case isn't a Status Bar and the information are:

>>>> Control <<<<
Class:  ScrollBar
Instance: 1
ClassnameNN: ScrollBar1
Name:   
Advanced (Class): [CLASS:ScrollBar; INSTANCE:1]
Style: 0x54000018
ExStyle: 0x00000000

So is a scrollbar? But how to create it without using a Status Bar?

Edited by MyEarth

Share this post


Link to post
Share on other sites



I maybe wrong but this is not a control, you just have to make your GUI resizable to have it!

Share this post


Link to post
Share on other sites

You are wrong, make a resizable gui don't add that

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

No, there isn't any status bar in the second screenshot ( where you can see it? :Donly that ScrollBar i'm sure of that and Autoit Window Info confirm.  The status bas is in SciTe and Internet Explorer, just for make an example, but i'd like to know how that software has make that control without a status bar.

Edited by MyEarth

Share this post


Link to post
Share on other sites

MyEarth,

All I can find about these sizing grips is this thread which is not quite what you want, but pretty close. :)

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

Melba, thanks for the suggestion. Is very close but not the same...if i don't find a solution i'll use that.

Good to know is called "sizing grips" :D

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Well, i have found an example on Vbforums for make the same size grip, without the status bar:

2m7gk1x.png

The question is:

Someone knows VB? :D

SizeGrip.zip

Edited by MyEarth

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I'm near to the answer. Reading this post:

You have to create a new child window with class name Scrollbar and control style SBS_SIZEGRIP

Everything comes back! That's why that control is called "Scrollbar"

The info at the page Scroll Bar Control Styles. We need to use CreateWindow ( in autoit i don't have find ) or CreateWindowEx ( in Autoit is called _WinAPI_CreateWindowEx ) with Class = Scrollbar and the $SBS_SIZEGRIP const, that doesn't exist in our UDF ( in theory is 0x10 because the original is Const SBS_SIZEGRIP = &H10 )

A little hand is appreciated :D

EDIT: This are all the style from a spy tool of that "Scroolbar" control:

WS_OVERLAPPED

WS_CLIPSIBLINGS

WS_VISIBLE

WS_CHILD

SBS_HORZ

SBS_SIZEBOX

SBS_SIZEGRIP

Edited by MyEarth

Share this post


Link to post
Share on other sites

MyEarth,

I have got the resizing to work: :)

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

Global $hGUI = GUICreate("Sizetest", Default, Default, Default, Default, $WS_SIZEBOX)

GUISetState()

GUIRegisterMsg($WM_PAINT, "_WM_PAINT")
GUIRegisterMsg($WM_NCHITTEST, "_WM_NCHITTEST")

$aPos = WinGetPos($hGUI)
WinMove($hGUI, "", $aPos[0], $aPos[1], $aPos[2] + 1, $aPos[3])

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

Func _WM_PAINT($hWnd, $uMsg, $wParam, $lParam)

    ; Init paint
    Local $tPS = DllStructCreate("ptr hdc; BOOL fErase;long rcPaint[4]; BOOL fRestore; BOOL fIncUpdate; BYTE rgbReserved[32];")
    Local $aPaint = DllCall("user32.dll", "handle", "BeginPaint", "hwnd", $hWnd, "ptr", DllStructGetPtr($tPS))
    If @error Then Return $GUI_RUNDEFMSG
    Local $hDC = $aPaint[0]

    ; Draw size grip
    Local $aPos = WinGetClientSize($hWnd)
    DrawFrameControl($hDC, $aPos[0] - 25, $aPos[1] - 25, $aPos[0], $aPos[1])

    ; Finish Paint
    DllCall("user32.dll", "bool", "EndPaint", "hwnd", $hWnd, "ptr", $aPaint[2])

    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_PAINT

Func DrawFrameControl($hDC, $nLeft, $nTop, $nRight, $nBottom)

    Local Const $DFC_SCROLL = 3, $DFCS_SCROLLSIZEGRIP = 8
    Local $stRect = DllStructCreate("int;int;int;int")

    DllStructSetData($stRect, 1, $nLeft)
    DllStructSetData($stRect, 2, $nTop)
    DllStructSetData($stRect, 3, $nRight)
    DllStructSetData($stRect, 4, $nBottom)

    DllCall("user32.dll", "int", "DrawFrameControl", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "int", $DFC_SCROLL, "int", $DFCS_SCROLLSIZEGRIP)

EndFunc   ;==>DrawFrameControl

Func _WM_NCHITTEST($hWnd, $uMsg, $wParam, $lParam)

    Switch $hWnd
        Case $hGUI
            Local $iXPos = _WinAPI_LoWord($lParam)
            Local $iYPos = _WinAPI_HiWord($lParam)
            Local $aPos = WinGetPos($hWnd)
            Local $aClient = WinGetClientSize($hWnd)
            Local $iBorder = ($aPos[2] - $aClient[0]) / 2
            If ($iXPos > $aPos[0] + $aPos[2] - 25 - $iBorder) And ($iYPos > $aPos[1] + $aPos[3] - 25 - $iBorder) Then
                Return $HTBOTTOMRIGHT
            EndIf
    EndSwitch
    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WM_NCHITTEST
Now to get the cursor to change as well. ;)

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

What about this:

 

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

Opt( "WinWaitDelay", 0 )
Opt( "MustDeclareVars", 1 )

Global $hGui, $hDots

Example()

Func Example()

  $hGui = GUICreate( "Drag dots", 300, 200, -1, 300, $WS_OVERLAPPEDWINDOW )
  $hDots = CreateDragDots( $hGui )

  GUIRegisterMsg( $WM_SIZE, "WM_SIZE" )

  GUISetState()

  While 1

    Switch GUIGetMsg()

      Case $GUI_EVENT_CLOSE
        ExitLoop

    EndSwitch

  WEnd

  GUIDelete( $hGui )
  Exit

EndFunc

Func CreateDragDots( $hGui )
  Local $aCall = DllCall( "user32.dll", "hwnd", "CreateWindowExW", _
    "dword", 0, _
    "wstr", "Scrollbar", _
    "ptr", 0, _
    "dword", 0x50000018, _ ; $WS_CHILD|$WS_VISIBLE|$SBS_SIZEBOX|$SBS_SIZEBOXOWNERDRAWFIXED
    "int", 0, _
    "int", 0, _
    "int", 17, _ ; Width
    "int", 17, _ ; Height
    "hwnd", $hGui, _
    "hwnd", 0, _
    "hwnd", 0, _
    "int", 0 )
  If @error Or Not $aCall[0] Then Return SetError(1, 0, 0)
  Return $aCall[0]
EndFunc

Func WM_SIZE( $hWnd, $iMsg, $wParam, $lParam )
  #forceref $iMsg
  Local $aClientSize[2] = [ BitAND( $lParam, 65535 ), BitShift( $lParam, 16 ) ]
  If $hWnd = $hGui Then
    Switch $wParam
      Case 0
        WinMove( $hDots, 0, $aClientSize[0] - 17, $aClientSize[1] - 17 )
        WinSetState( $hDots, 0, @SW_RESTORE )
      Case 2; SIZE_MAXIMIZED
        WinSetState( $hDots, 0, @SW_HIDE )
    EndSwitch
  EndIf
EndFunc

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