Alaska Software Inc. - Scrollbars in xbpDialog
Username: Password:
AuthorTopic: Scrollbars in xbpDialog
Ron MeijerScrollbars in xbpDialog
on Mon, 17 Sep 2007 09:03:08 +0200
Can somebody tell me if there is a way to control the scrollbars in a 
xbpDialog? I like to move them with the mousewheel or arrowkeys. SetPos etc. 
only changes the origin of the drawing not the position of the drawing like 
moved with the scrollbars.

Thanks,

Ron Meijer
Thomas Braun
Re: Scrollbars in xbpDialog
on Mon, 17 Sep 2007 11:57:16 +0200
Ron Meijer wrote:

> Can somebody tell me if there is a way to control the scrollbars in a 
> xbpDialog? I like to move them with the mousewheel or arrowkeys. SetPos etc. 
> only changes the origin of the drawing not the position of the drawing like 
> moved with the scrollbars.

Not sure if I understand your question correctly - the manipulation of the
scrollbar can be done via its getData()/setData()/setRange() methods.

Maybe you should describe your problem a bit more detailed, e.g. what
"drawing" you are referring to or what the purpose of the dialog window
is...

regards
Thomas
Günter Beyes Re: Scrollbars in xbpDialog
on Mon, 17 Sep 2007 14:29:53 +0200
Hi Ron,

talking scrollbars created by oDlg:hasScrollBars := TRUE ?

Regards,
Günter


> Can somebody tell me if there is a way to control the scrollbars in a 
> xbpDialog? I like to move them with the mousewheel or arrowkeys. SetPos etc. 
> only changes the origin of the drawing not the position of the drawing like 
> moved with the scrollbars.
> 
> Thanks,
> 
> Ron Meijer
AUGE_OHRRe: Scrollbars in xbpDialog
on Mon, 17 Sep 2007 15:58:05 +0200
hi,

> Can somebody tell me if there is a way to control the scrollbars in a 
> xbpDialog? I like to move them with the mousewheel or arrowkeys.

oDlg := XbpDialog():new(AppDesktop(),,aPos,aSize,,.F.)
...
oDlg:DrawingArea:wheel     := {| aPos,aWheel,obj | DLGWHEEL(aWheel, myArray, 
...)}
...

PROCEDURE DlgWheel(aWheel,aoChild ...)
   IF aWheel[2] < 0
      aoChild[CH_BAR]:setData(aoChild[CH_BAR]:getData()+1)
      Scrollbar(aoChild[CH_BAR]:getData(),XBPSB_NEXTPOS, ...)
   ELSE
      aoChild[CH_BAR]:setData(aoChild[CH_BAR]:getData() - 1)
      Scrollbar(aoChild[CH_BAR]:getData(),XBPSB_PREVPOS,...)
   ENDIF
RETURN

greetings by OHR
Jimmy
Ron MeijerRe: Scrollbars in xbpDialog
on Tue, 18 Sep 2007 09:38:37 +0200
Thanks for reply,

The situation is as follows:

oDialog:DrawingArea:Scrollbars := XBP_SCROLLBAR_HORIZ+XBP_SCROLLBAR_VERT

Using this dialog as a parent for an xbpstatic with a bitmap caption.
The xbpstatic(child) is bigger in size than the xbpdialog.

In this case scrollbars are presented on the implicit window (drawingarea). 
These scrollbars are the ones i like to control in the way Jimmy describes. 
Sinse there is no reference to this scrollbar objects i'm in the dark.

Regards,

Ron Meijer


"AUGE_OHR" <AUGE_OHR*AT*CSI.COM> schreef in bericht 
news:35d2a982$42a5aa$4a3f4@news.alaska-software.com...
> hi,
>
>> Can somebody tell me if there is a way to control the scrollbars in a 
>> xbpDialog? I like to move them with the mousewheel or arrowkeys.
>
> oDlg := XbpDialog():new(AppDesktop(),,aPos,aSize,,.F.)
> ...
> oDlg:DrawingArea:wheel     := {| aPos,aWheel,obj | DLGWHEEL(aWheel, 
> myArray, ...)}
> ...
>
> PROCEDURE DlgWheel(aWheel,aoChild ...)
>   IF aWheel[2] < 0
>      aoChild[CH_BAR]:setData(aoChild[CH_BAR]:getData()+1)
>      Scrollbar(aoChild[CH_BAR]:getData(),XBPSB_NEXTPOS, ...)
>   ELSE
>      aoChild[CH_BAR]:setData(aoChild[CH_BAR]:getData() - 1)
>      Scrollbar(aoChild[CH_BAR]:getData(),XBPSB_PREVPOS,...)
>   ENDIF
> RETURN
>
> greetings by OHR
> Jimmy
>
Günter Beyes Re: Scrollbars in xbpDialog
on Tue, 18 Sep 2007 18:46:43 +0200
Hi Ron,

> oDialog:DrawingArea:Scrollbars := XBP_SCROLLBAR_HORIZ+XBP_SCROLLBAR_VERT
> 
> Using this dialog as a parent for an xbpstatic with a bitmap caption.
> The xbpstatic(child) is bigger in size than the xbpdialog.
> 
> In this case scrollbars are presented on the implicit window (drawingarea). 
> These scrollbars are the ones i like to control in the way Jimmy describes. 
> Sinse there is no reference to this scrollbar objects i'm in the dark.

currently, in Xbase++, that kind of scrollbars are controllable only via 
Windows API calls. Those are not regular scrollbars a.k.a. XbpScrollbar 
objects, but are a part of the window itself, comparable to XbpMLE 
scrollbars in that respect.

The following rough sample might be a start. You might want to check out 
the Scroll Bar topic on MSDN for more.

Regards,
Günter

////////////////////////////////////////////////////////
 snippet from event loop

nEvent := AppEvent( @mp1, @mp2, @oXbp )
IF nEvent = xbeP_Keyboard 
   IF mp1 = xbeK_UP
      ScrollDlg( oDlg, 1 )
   ELSEIF mp1 = xbeK_DOWN
      ScrollDlg( oDlg, 2 )
   ELSEIF mp1 = xbeK_LEFT
      ScrollDlg( oDlg, 3 )
   ELSEIF mp1 = xbeK_RIGHT
      ScrollDlg( oDlg, 4 )
   ENDIF
ENDIF

////////////////////////////////////////////////////////

#define WM_HSCROLL 0x0114
#define WM_VSCROLL 0x0115

#define SB_HORZ      0
#define SB_VERT      1

#define SB_LINEUP    0
#define SB_LINELEFT  0
#define SB_LINEDOWN  1
#define SB_LINERIGHT 1

PROCEDURE ScrollDlg( oDlg, nDirection )
LOCAL hwnd := oDlg:drawingArea:getHWND()
LOCAL nMin := 0, nMax := 0

IF nDirection = 1 .or. nDirection = 2    vertical
   GetScrollRange( hwnd, SB_VERT, @nMin, @nMax )
   IF nMin <> 0 .or. nMax <> 0  does that scrollbar exist ?
      IF nDirection = 1    up
         SendMessageA( hwnd, WM_VSCROLL, SB_LINEUP, 0 )
      ELSE                 down
         SendMessageA( hwnd, WM_VSCROLL, SB_LINEDOWN, 0 )
      ENDIF
   ENDIF	
ELSEIF nDirection = 3 .or. nDirection = 4    horizontal
   GetScrollRange( hwnd, SB_HORZ, @nMin, @nMax )
   IF nMin <> 0 .or. nMax <> 0
      IF nDirection = 3    left
         SendMessageA( hwnd, WM_HSCROLL, SB_LINELEFT, 0 )
      ELSE                 right
         SendMessageA( hwnd, WM_HSCROLL, SB_LINERIGHT, 0 )
      ENDIF
   ENDIF
ENDIF

RETURN

DLLFUNCTION GetScrollRange( hwnd, nBar, @nMin, @nMax ) USING STDCALL FROM 
user32.dll
DLLFUNCTION SendMessageA( hwnd, nMsg, wparam, lparam ) USING STDCALL FROM 
user32.dll
Ron MeijerRe: Scrollbars in xbpDialog
on Wed, 19 Sep 2007 18:36:41 +0200
!!The following rough sample might be a start

Hi Gnter,

A rough sample? It is exactly what i needed and it works just fine.

Tanks for your help,

Ron Meijer

"Gnter Beyes" <"gbeyes at gmx.de"> schreef in bericht 
news:3o5jr8lwu23s.dqso9ht9ulle$.dlg@40tude.net...
> Hi Ron,
>
>> oDialog:DrawingArea:Scrollbars := XBP_SCROLLBAR_HORIZ+XBP_SCROLLBAR_VERT
>>
>> Using this dialog as a parent for an xbpstatic with a bitmap caption.
>> The xbpstatic(child) is bigger in size than the xbpdialog.
>>
>> In this case scrollbars are presented on the implicit window 
>> (drawingarea).
>> These scrollbars are the ones i like to control in the way Jimmy 
>> describes.
>> Sinse there is no reference to this scrollbar objects i'm in the dark.
>
> currently, in Xbase++, that kind of scrollbars are controllable only via
> Windows API calls. Those are not regular scrollbars a.k.a. XbpScrollbar
> objects, but are a part of the window itself, comparable to XbpMLE
> scrollbars in that respect.
>
> The following rough sample might be a start. You might want to check out
> the Scroll Bar topic on MSDN for more.
>
> Regards,
> Gnter
>
> ////////////////////////////////////////////////////////
>  snippet from event loop
>
> nEvent := AppEvent( @mp1, @mp2, @oXbp )
> IF nEvent = xbeP_Keyboard
>   IF mp1 = xbeK_UP
>      ScrollDlg( oDlg, 1 )
>   ELSEIF mp1 = xbeK_DOWN
>      ScrollDlg( oDlg, 2 )
>   ELSEIF mp1 = xbeK_LEFT
>      ScrollDlg( oDlg, 3 )
>   ELSEIF mp1 = xbeK_RIGHT
>      ScrollDlg( oDlg, 4 )
>   ENDIF
> ENDIF
>
> ////////////////////////////////////////////////////////
>
> #define WM_HSCROLL 0x0114
> #define WM_VSCROLL 0x0115
>
> #define SB_HORZ      0
> #define SB_VERT      1
>
> #define SB_LINEUP    0
> #define SB_LINELEFT  0
> #define SB_LINEDOWN  1
> #define SB_LINERIGHT 1
>
> PROCEDURE ScrollDlg( oDlg, nDirection )
> LOCAL hwnd := oDlg:drawingArea:getHWND()
> LOCAL nMin := 0, nMax := 0
>
> IF nDirection = 1 .or. nDirection = 2    vertical
>   GetScrollRange( hwnd, SB_VERT, @nMin, @nMax )
>   IF nMin <> 0 .or. nMax <> 0  does that scrollbar exist ?
>      IF nDirection = 1    up
>         SendMessageA( hwnd, WM_VSCROLL, SB_LINEUP, 0 )
>      ELSE                 down
>         SendMessageA( hwnd, WM_VSCROLL, SB_LINEDOWN, 0 )
>      ENDIF
>   ENDIF
> ELSEIF nDirection = 3 .or. nDirection = 4    horizontal
>   GetScrollRange( hwnd, SB_HORZ, @nMin, @nMax )
>   IF nMin <> 0 .or. nMax <> 0
>      IF nDirection = 3    left
>         SendMessageA( hwnd, WM_HSCROLL, SB_LINELEFT, 0 )
>      ELSE                 right
>         SendMessageA( hwnd, WM_HSCROLL, SB_LINERIGHT, 0 )
>      ENDIF
>   ENDIF
> ENDIF
>
> RETURN
>
> DLLFUNCTION GetScrollRange( hwnd, nBar, @nMin, @nMax ) USING STDCALL FROM
> user32.dll
> DLLFUNCTION SendMessageA( hwnd, nMsg, wparam, lparam ) USING STDCALL FROM
> user32.dll