Set width of scrollbar

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Set width of scrollbar

Post 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
User avatar
jairpinho
Posts: 420
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Contact:

Re: Set width of scrollbar

Post by jairpinho »

hello Marek, you started talking about a grid scrollbar now at the end and talking about a window scrollbar would be both.
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br
User avatar
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

Post 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 2300 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
have fun
Jimmy
User avatar
jairpinho
Posts: 420
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Contact:

Re: Set width of scrollbar

Post 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
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Set width of scrollbar

Post by mol »

Thanks guys.
I'll try to prepare small sample to show my problem
Post Reply