Melba23

Scrollbars Made Easy - New version 16 Feb 17

166 posts in this topic

#161 ·  Posted (edited)

@Melba23

I have use this UDF to create scrollbars for a case as below. Its is working fine line until a particular height. As I've mentioned in the comment below whenever I'm increasing the height of the window by increasing the value of the LabelCnt variable beyond 32, some of the page is not visible. Any advice on how to overcome this or what what I'm doing wrong?

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

Opt("GUIOnEventMode", 1)

$MainScreen = GUICreate("Expense Tracker", 600, 520, -1, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "ExitAll")
GUISetBkColor(0xE0E0E0)
GUISetState()

$CategoriesListScr = GUICreate("", 250, 480, 0, 40, $WS_POPUP, $WS_EX_MDICHILD, $MainScreen)
GUISetFont(14, 500, 0, "Calibri")
GUISetBkColor(0xFFFFFF)
GUICtrlSetResizing($CategoriesListScr, $GUI_DOCKALL)
GUISetState()

$LastLine = 0

For $LabelCnt = 0 To 31; Working fine till 30; Half the label gets hidden from 32 and a full control is hidden from 44
    $LastLine += 40

    GUICtrlCreateLabel("Test String" & $LabelCnt, 47, $LastLine, 250, 40, $SS_CENTERIMAGE)
Next

_GUIScrollbars_Generate($CategoriesListScr, 250, $LastLine + 40)
_GUIScrollBars_ShowScrollBar($CategoriesListScr, $SB_HORZ, False)

While 1

WEnd

Func ExitAll()
    Exit
EndFunc   ;==>ExitAll

 

Edited by siva1612

Share this post


Link to post
Share on other sites



#162 ·  Posted

siva1612,

If I remove the _GUIScrollBars_ShowScrollBar line I get all the labels displayed - I tested up to 200. You can remove the horizontal scrollbar by setting the _GUIScrollbars_Generate horizontal parameter to 0:

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

Opt("GUIOnEventMode", 1)

$MainScreen = GUICreate("Expense Tracker", 600, 520, -1, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "ExitAll")
GUISetBkColor(0xE0E0E0)
GUISetState()

$CategoriesListScr = GUICreate("", 250, 480, 0, 40, $WS_POPUP, $WS_EX_MDICHILD, $MainScreen)
GUISetFont(14, 500, 0, "Calibri")
GUISetBkColor(0xFFFFFF)
GUICtrlSetResizing($CategoriesListScr, $GUI_DOCKALL)
GUISetState()

$LastLine = -30

For $LabelCnt = 0 To 200; Working fine
    $LastLine += 40
    GUICtrlCreateLabel("Test String" & $LabelCnt, 47, $LastLine, 250, 40, $SS_CENTERIMAGE)
Next

_GUIScrollbars_Generate($CategoriesListScr, 0, $LastLine + 40)
;_GUIScrollBars_ShowScrollBar($CategoriesListScr, $SB_HORZ, False)

While 1
    Sleep(10) ; You need a Sleep to stop the CPU from frying <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
WEnd

Func ExitAll()
    Exit
EndFunc   ;==>ExitAll

Note my comment about the idle loop Sleep.

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

#163 ·  Posted (edited)

Hi,

I tried your fine UDF. It works fine on PC, but not on WIN10 Tablet. Do you have any idea, what I can do? On PC you can scroll the left area with mousewheel or use the scrollbar with mouse. On Tablet: Only using the scrollbar with the finger it scrolls the left gui-area. Using the finger inside the gui-area nothing ... Any idea?

I tried also this other example .

Thanks

Best regards

Thomas

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <ListViewConstants.au3>
#include <SendMessage.au3>
#include "GUIScrollbars_Ex.au3"

startGui()

Func startGui()
    $Gui = GUICreate("", 700, 600, -1, -1, $WS_POPUP)
    $up = GUICtrlCreateButton("UP", 10, 10, 80, 40)
    $down = GUICtrlCreateButton("DOWN", 100, 10, 80, 40)
    GUICtrlCreateLabel("Close with ESC", 550, 10, 120, 40)
    GUIRegisterMsg($WM_MOUSEWHEEL, "_Scrollbars_WM_MOUSEWHEEL")
    $hScrollPl = GUICreate("$hScrollPl", 500, 400, 10, 100, BitOR($WS_POPUP, $WS_GROUP, $WM_VSCROLL, $WS_CLIPSIBLINGS), $WS_EX_MDICHILD, $Gui)
    GUISetBkColor(0xffffff)

    $art = GUICtrlCreateLabel("", 1, 1)

    $hListV = GUICtrlCreateListView("1|2", 100, 100, 300, 200, BitOR($LVS_REPORT, $LVS_NOCOLUMNHEADER, $LVS_SHOWSELALWAYS))
    _GUIScrollbars_Generate($hScrollPl, 0,3000)
    ;_GUIScrollbars_Scroll_Page($hScrollPl, 0, 99)
    GUISetState(@SW_SHOW, $Gui)
    GUISetState(@SW_SHOW, $hScrollPl)
    GUICtrlSetState($art, $GUI_FOCUS); Focus auf Label von $hScrollPl
    GUISwitch($Gui)
    ;GUISetState(@SW_SHOW, $Gui)

    While 1
        $iMsg3 = GUIGetMsg()
        Switch $iMsg3
            Case $GUI_EVENT_CLOSE
                Exit
            Case $up
                MsgBox(0, "Info", "Button up pressed")
                GUICtrlSetState($art, $GUI_FOCUS); Focus on Label $hScrollPl
            Case $down
                MsgBox(0, "Info", "Button down pressed")
                GUICtrlSetState($art, $GUI_FOCUS); Focus on Label $hScrollPl
        EndSwitch
    WEnd
EndFunc   ;==>startGui

 

Edited by TJF

Share this post


Link to post
Share on other sites

#164 ·  Posted

TJF,

The UDF has no code to react to tablet gestures. Now I have a Win 10 tablet to work on I will see what I can do to add some.

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

#165 ·  Posted (edited)

Thanks a lot M23 !

I think WM_TOUCH ( GESTURE_TOUCH.zip ) is the way to go...?

Edited by TJF

Share this post


Link to post
Share on other sites
On 4/10/2017 at 9:03 AM, Melba23 said:

TJF,

The UDF has no code to react to tablet gestures. Now I have a Win 10 tablet to work on I will see what I can do to add some.

M23

It would be a great improvement!

Greets from Barcelona 

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