Page 2 of 2

Re: Set width of scrollbar

Posted: Thu Sep 05, 2019 6:18 am
by mol
I've created function to scroll window:

Code: Select all

#pragma BEGINDUMP

#include "HMG_UNICODE.h"

#include <windows.h>
#include <commctrl.h>
#include "tchar.h"
#include "hbapi.h"



HB_FUNC( SCROLL_WINDOW )
{
	HWND hwnd;
	HDC hdc; 
	PAINTSTRUCT ps; 
	TEXTMETRIC tm; 
	SCROLLINFO si; 
	 
	static int yPos;        // current vertical scrolling position 
	 
	int yChar;       // vertical scrolling unit 

	hwnd = (HWND) HMG_parnl (1);
	yChar = hb_parni(2);

	 // Get all the vertial scroll bar information.
	si.cbSize = sizeof (si);
	si.fMask  = SIF_ALL;
	SetScrollInfo (hwnd, SB_VERT, &si, TRUE);
	GetScrollInfo (hwnd, SB_VERT, &si);

	// Save the position for comparison later on.
	yPos = si.nPos;
	si.nPos -= 1;
	ScrollWindow(hwnd, 0, yChar * (yPos - si.nPos), NULL, NULL);
	UpdateWindow (hwnd);
	}
#PRAGMA ENDDUMP
it's called it this way:

Code: Select all

  SCROLL_WINDOW(nFormToScrollHandle, nNumberOfLines)
nNumberOfLines can be in plus or in minus

I don't know, how to create slider.
I've tried do use HMG Slider, but, it isn't it

Re: Set width of scrollbar

Posted: Thu Sep 05, 2019 10:41 pm
by jairpinho
hello Marek, you started talking about a grid scrollbar now at the end and talking about a window scrollbar would be both.

Re: Set width of scrollbar

Posted: Fri Sep 06, 2019 2:44 am
by AUGE_OHR
hi Marek,
mol wrote: Thu Sep 05, 2019 6:18 am I don't know, how to create slider.
I've tried do use HMG Slider, but, it isn't it
Browse/GRID have Scrollbar "build-in" but if you disable it and use other Control than you must build a new "bridge" between.
when move in Browse/GRID you have to tell Scrollbar new Position. same when move in Scrollbar

as you say you need bigger Button for Touch.

Scrollbar Button depend on Hight of Scrollbar and Wide is calculate by OS (visual Style must fit)
Slider does not have Button so you can make you own Button for navigation
Scrollbar_Slider.jpg
Scrollbar_Slider.jpg (72.11 KiB) Viewed 2316 times
have a look at Slider Sample how to use it

Code: Select all

c:\hmg.3.4.4\SAMPLES\Controls\Slider\
c:\hmg.3.4.4\SAMPLES\Controls\ProgressBar\
Note : as i know it have restriction to Range +-32768 ( have something to do with Mouse Move per Pixel )

send new Calculate Position to Browse/GRID and refresh it

---

from Browse / GRID

in Browse we have a "DbSkipper" and this for Scrollbar

Code: Select all

   // Navigation code blocks for the vertical scroll bar
   ::posBlock      := {| | (::oPG:DbPosition())    }
   ::goPosBlock    := {|n| (::oPG:GoPosition(n)) }
   ::lastPosBlock  := {| | 100             }
   ::firstPosBlock := {| | 0               }
when Browse is "stable" you can send DbPosition() to Scrollbar/Slider and update Position.

hope it help

Re: Set width of scrollbar

Posted: Fri Sep 06, 2019 3:55 am
by jairpinho
mol wrote: Thu Sep 05, 2019 6:18 am I've created function to scroll window:

Code: Select all

#pragma BEGINDUMP

#include "HMG_UNICODE.h"

#include <windows.h>
#include <commctrl.h>
#include "tchar.h"
#include "hbapi.h"



HB_FUNC( SCROLL_WINDOW )
{
	HWND hwnd;
	HDC hdc; 
	PAINTSTRUCT ps; 
	TEXTMETRIC tm; 
	SCROLLINFO si; 
	 
	static int yPos;        // current vertical scrolling position 
	 
	int yChar;       // vertical scrolling unit 

	hwnd = (HWND) HMG_parnl (1);
	yChar = hb_parni(2);

	 // Get all the vertial scroll bar information.
	si.cbSize = sizeof (si);
	si.fMask  = SIF_ALL;
	SetScrollInfo (hwnd, SB_VERT, &si, TRUE);
	GetScrollInfo (hwnd, SB_VERT, &si);

	// Save the position for comparison later on.
	yPos = si.nPos;
	si.nPos -= 1;
	ScrollWindow(hwnd, 0, yChar * (yPos - si.nPos), NULL, NULL);
	UpdateWindow (hwnd);
	}
#PRAGMA ENDDUMP
it's called it this way:

Code: Select all

  SCROLL_WINDOW(nFormToScrollHandle, nNumberOfLines)
nNumberOfLines can be in plus or in minus

I don't know, how to create slider.
I've tried do use HMG Slider, but, it isn't it
how you use this code in an application shows the complete code with function call

Re: Set width of scrollbar

Posted: Fri Sep 06, 2019 5:29 am
by mol
Thanks guys.
I'll try to prepare small sample to show my problem