Set width of scrollbar
Moderator: Rathinagiri
Set width of scrollbar
Hi guys!
I need to increase the width of vertical scrollbar of grid.
Does somebody know how to do it?
Is it possible?
I need to increase the width of vertical scrollbar of grid.
Does somebody know how to do it?
Is it possible?
- AUGE_OHR
- Posts: 2060
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: Set width of scrollbar
Scrollbar of GRID (Listview) can only switch on/off and they internal.
i have try to change Color of those Scrollbar but was not able to get a handle
the only Way was to switch internal Scrollbar OFF and make own Scrollbar / Slider.
i have try to change Color of those Scrollbar but was not able to get a handle
the only Way was to switch internal Scrollbar OFF and make own Scrollbar / Slider.
have fun
Jimmy
Jimmy
Re: Set width of scrollbar
Marek
In my opinion, this can't be done in HMG.
In my opinion, this can't be done in HMG.
Re: Set width of scrollbar
I've searched for some solutions, but I'm not familiar with C
Re: Set width of scrollbar
This can be done as follows:
1. Remove internal Scrollbar from ListView (grid) control. It does not require coding in C.
2. Create your own Scrollbar control.
3. Handle Scrollbar control exceptions.
Unfortunately, in HMG can not remove the internal Scrollbar because WM_NCCALCSIZE message is not sent to events function.
And I don't know why!
Does anyone know?
1. Remove internal Scrollbar from ListView (grid) control. It does not require coding in C.
Code: Select all
//subclass ListView (grid):
EventCreate({ || GridEvents() }, hWndGrid, 0x83 /*WM_NCCALCSIZE*/)
FUNCTION GridEvents()
//remove internal Scrollbar
HMG_ChangeWindowStyle(EventHWND(), NIL, 0x00200000 /*WS_VSCROLL*/, NIL, .T.)
//or hide internal Scrollbar
//ShowScrollbar(EventHWND(), 1 /*SB_VERT*/, .F.);
RETURN NIL
3. Handle Scrollbar control exceptions.
Unfortunately, in HMG can not remove the internal Scrollbar because WM_NCCALCSIZE message is not sent to events function.
And I don't know why!
Does anyone know?
Re: Set width of scrollbar
I'm using my MiniGrid sample based on panel window.
I can hide scrollbars of this window by:
I can create two buttons for sliding window up and down, but, I don't know how to assign scrolling to them
PS. Jestem po prostu za cienki do programowania windowsów
I can hide scrollbars of this window by:
Code: Select all
HMG_ChangeWindowStyle(GetFormHandle(cFormName), NIL, WS_HSCROLL , .F.)
HMG_ChangeWindowStyle(GetFormHandle(cFormName), NIL, WS_VSCROLL , .F.)
PS. Jestem po prostu za cienki do programowania windowsów
Re: Set width of scrollbar
I've found a solution to create own scrollbar:
This scroolbar width is 200 px.
But - it doesn't scroll my window,
and, scrolling buttons (up and down) as small as standard scrollbar.
I'm building touch application, so these buttons should be bigger.
Code: Select all
pragma BEGINDUMP
#include "HMG_UNICODE.h"
#include <windows.h>
#include <commctrl.h>
#include "tchar.h"
#include "hbapi.h"
HB_FUNC( CREATEVERTICALSCROLLBAR )
{
HWND hwndParent;
HWND hWnd_Control;
hwndParent = (HWND) HMG_parnl (1);
RECT rect;
// Get the dimensions of the parent window's client area;
if (!GetClientRect(hwndParent, &rect))
HMG_retnl( NULL );
// Create the scroll bar.
hWnd_Control = CreateWindowEx(
0, // no extended styles
"SCROLLBAR", // scroll bar control class
(PTSTR) NULL, // no window text
WS_CHILD | WS_VISIBLE // window styles
| SBS_VERT, // horizontal scroll bar style
rect.left, // vertical position
rect.bottom - 200, // vertical position
rect.right, // width of the scroll bar
200, //sbHeight, height of the scroll bar
hwndParent, // handle to main window
(HMENU) NULL, // no menu
GetModuleHandle(NULL), //g_hInst, instance owning this window
(PVOID) NULL ); // pointer not needed
HMG_retnl ((LONG_PTR) hWnd_Control);
}
#PRAGMA ENDDUMP
But - it doesn't scroll my window,
and, scrolling buttons (up and down) as small as standard scrollbar.
I'm building touch application, so these buttons should be bigger.
Re: Set width of scrollbar
Marek
About Scrollbars read here:
https://docs.microsoft.com/en-us/window ... croll-bars
CreateWindowEx function (as wapi_CreateWindowEx) is implemented in hbwin library.
It also contains several Scrollbar functions.
Sources are in:
wapi_winuser_1.c
About Scrollbars read here:
https://docs.microsoft.com/en-us/window ... croll-bars
CreateWindowEx function (as wapi_CreateWindowEx) is implemented in hbwin library.
It also contains several Scrollbar functions.
Sources are in:
wapi_winuser_1.c