Move the dialog with a Hand

Move the dialog with a Hand

Postby Silvio » Sat Mar 14, 2009 1:56 am

the sample TestWScr.prg create a window with vertical and Horizontal scroll
can the user move the window with the mouse if click on window
I 'd like see a cursour hand and click on center and move the window as I click on the thumb of scrollbar....
Do U help me to create it ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Move the dialog with a Hand

Postby Antonio Linares » Sat Mar 14, 2009 9:36 am

Silvio,

Here you have a working example:
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oWnd, nRowPos, nColPos, lDrag := .F., oCrsHand

   DEFINE CURSOR oCrsHand HAND

   DEFINE WINDOW oWnd STYLE WS_POPUP COLOR "W/R"

   oWnd:bLClicked := { | nRow, nCol | nRowPos := nRow, nColPos := nCol, lDrag := .T., oWnd:oCursor := oCrsHand }
     
   oWnd:bMMoved = { | nRow, nCol | If( lDrag, oWnd:Move( oWnd:nTop + nRow - nRowPos,;
                                         oWnd:nLeft + nCol - nColPos ),) }  

   oWnd:bLButtonUp := { || lDrag := .F., oWnd:oCursor := nil }

   ACTIVATE WINDOW oWnd
     
return nil
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Move the dialog with a Hand

Postby Marc Vanzegbroeck » Sat Mar 14, 2009 4:14 pm

Antonio,

When I run this sample I get a red rectangle that I can move by dragging it, but how can I close this?

Regards,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Move the dialog with a Hand

Postby Antonio Linares » Sat Mar 14, 2009 11:30 pm

Marc,

Press Alt + F4
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Move the dialog with a Hand

Postby Silvio » Sun Mar 15, 2009 12:52 am

Antonio,
I thinked to move the controls on a dialog and not move the position of the dialog

I explain you
see this image i use a dialog with style nOR( WS_CHILD, 4 )

the user can click on dialog and move the scroll position and see the other controls

Image

If the user click on dialog with the mouse can move on the left or on the right or up and down and see the other control in this dialog
Now I can see all controls if I press on thumb of scroll


If I use the class TScrWnd with a Dialog I can use your commands also with a dialog style nOR( WS_CHILD, 4 ) ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Move the dialog with a Hand

Postby Antonio Linares » Sun Mar 15, 2009 8:16 am

Silvio,

Use oControl:lDrag := .T.

that DATA is what it is set with the clause DESIGN
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Move the dialog with a Hand

Postby Silvio » Sun Mar 15, 2009 11:40 pm

perhaps U not understand me what I want make

type this...

oDlg:bLClicked := { | nRow, nCol | nRowPos := nRow, nColPos := nCol, lDrag := .T., oDlg:oCursor := oCrsHand }

oDlg:bMMoved = Set_SCROLL( oDlg,10 )



STATIC FUNCTION Set_SCROLL( oDlg,ntop )
LOCAL nStep := 30
oDlg:oVScroll:SetRange( 1, 10 )
oDlg:oVScroll:nPgStep = 1

oDlg:oVScroll:bGoUp = { || Move_controls( oDlg, nStep,ntop ) }
oDlg:oVScroll:bGoDown = { || Move_controls( oDlg, -nStep ,ntop) }
oDlg:oVScroll:bPageUp = { || Move_controls( oDlg, nStep ,ntop) }
oDlg:oVScroll:bPageDown = { || Move_controls( oDlg, -nStep,ntop ) }

oDlg:oHScroll:bGoUp = { || Move_controls( oDlg, nStep,ntop ) }
oDlg:oHScroll:bGoDown = { || Move_controls( oDlg, -nStep ,ntop) }
oDlg:oHScroll:bPageUp = { || Move_controls( oDlg, nStep ,ntop) }
oDlg:oHScroll:bPageDown = { || Move_controls( oDlg, -nStep,ntop ) }





RETURN NIL



STATIC FUNCTION Move_controls( oDlg, nStep,ntop )
LOCAL i
Local len:=len(oDlg:aControls )

IF nStep < 0 .AND. oDlg:aControls[len]:nTop + nStep = ntop
RETURN NIL
ENDIF
IF nStep > 0 .AND. oDlg:aControls[ 4 ]:nTop - nStep = ntop
RETURN NIL
ENDIF
FOR i = 2 TO LEN( oDlg:aControls )
oDlg:aControls[ i ]:Move( oDlg:aControls[ i ]:nTop + nStep, oDlg:aControls[ i ]:nLeft )

// Change from here
if oDlg:aControls[1]:nBottom + 60 > oDlg:aControls[i]:nTop
oDlg:aControls[i]:hide()
else
oDlg:aControls[i]:show()
endif
NEXT
oDlg:Refresh()
RETURN NIL
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Move the dialog with a Hand

Postby lailton.webmaster » Sun Mar 15, 2009 11:54 pm

U can use too this...

Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   public oWnd

   DEFINE DIALOG ownd  title "FiveWin - Move"
   ACTIVATE dialog oWnd centered ON LEFT  CLICK DRAGDLG( ownd )

return nil

STATIC FUNCTION DRAGDLG( oDlg )
    LOCAL aCoo := GETWNDRECT( oDlg:hWnd )
    LOCAL aOrg := GETCURSORPOS()
    LOCAL aPos, i
    WHILE GETKEYSTATE( VK_RBUTTON )
        aPos = GETCURSORPOS()
        oDlg:oCursor := oCrsHand
        MOVEWINDOW( oDlg:hWnd, aCoo[ 1 ] + aPos[ 1 ] - aOrg[ 1 ], aCoo[ 2 ] + aPos[ 2 ] - aOrg[ 2 ],,,.T.)
        FOR i = 1 TO 10
            SYSREFRESH()
        NEXT
    ENDDO
RETURN NIL
 
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Move the dialog with a Hand

Postby Silvio » Mon Mar 16, 2009 12:07 am

Dear Laiton,
perhaps U not undestand me
listen !!

I have a dialog ok ?
on this dialog I have many controls ok ?

then I have a vertical and a Horizontal scrollbar but I not want use they for scroll the dialog

If I click on background of this dialog the procedure shoe a cursor hand and I can scroll the dialog where I want : if I move the mouse on left or an right ( or up and down)
I can see all controls are moved

Imagine
you have a pdf into your screen : you can click on this pdf and move the page up and down left and right : you not move the window but U move what is write on this page

do U understand what I want make ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Move the dialog with a Hand

Postby lailton.webmaster » Mon Mar 16, 2009 12:18 am

I can understand more.. sorry i can´t help
think that Antonio is people that know how make it...

i think that you need use "acontrols:lDrag := .T." but o don´t meet very think about it.

thanks :lol:
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Move the dialog with a Hand

Postby Otto » Mon Mar 16, 2009 9:32 am

Hello Silvio,

I had a look into testwscr.prg.

I think you need a kind of PAN functionality.

I tried with the code I attached I think this could work. Press down the wheel - like in AutoCad - and then move the mouse.
Please post back your code changes if you have success.


Best regards,
Otto

Code: Select all  Expand view
// Testing how to scroll a window with its contents
//PAN function
#include "FiveWin.ch"

#define D_WIDTH           4
#define D_HEIGHT          13

FUNCTION Main()
LOCAL oWnd,oScrWnd,nRowPos, nColPos, lDrag := .F.
LOCAL cGet0101 := space(10),  ; //Row 1
      cGet0102 := space(10),  ;
      cGet0103 := space(10),  ;
      cGet0104 := space(10),  ;
      cGet0105 := space(10),  ;
      cGet0201 := space(10),  ; //Row 2
      cGet0202 := space(10),  ;
      cGet0203 := space(10),  ;
      cGet0204 := space(10),  ;
      cGet0205 := space(10),  ;
      cGet0301 := space(10),  ; //Row 3
      cGet0302 := space(10),  ;
      cGet0303 := space(10),  ;
      cGet0304 := space(10),  ;
      cGet0305 := space(10),  ;
      cGet0401 := space(10),  ; //Row 4
      cGet0402 := space(10),  ;
      cGet0403 := space(10),  ;
      cGet0404 := space(10),  ;
      cGet0405 := space(10),  ;
      cGet0501 := space(10),  ; //Row 5
      cGet0502 := space(10),  ;
      cGet0503 := space(10),  ;
      cGet0504 := space(10),  ;
      cGet0505 := space(10),  ;
      cGet0601 := space(10),  ; //Row 6
      cGet0602 := space(10),  ;
      cGet0603 := space(10),  ;
      cGet0604 := space(10),  ;
      cGet0605 := space(10),  ;
      cGet0701 := space(10),  ; //Row 7
      cGet0702 := space(10),  ;
      cGet0703 := space(10),  ;
      cGet0704 := space(10),  ;
      cGet0705 := space(10),  ;
      cGet0801 := space(10),  ; //Row 8
      cGet0802 := space(10),  ;
      cGet0803 := space(10),  ;
      cGet0804 := space(10),  ;
      cGet0805 := space(10),  ;
      cGet0901 := space(10),  ; //Row 9
      cGet0902 := space(10),  ;
      cGet0903 := space(10),  ;
      cGet0904 := space(10),  ;
      cGet0905 := space(10),  ;
      cGet1001 := space(10),  ; //Row 10
      cGet1002 := space(10),  ;
      cGet1003 := space(10),  ;
      cGet1004 := space(10),  ;
      cGet1005 := space(10),  ;
      cGet1101 := space(10),  ; //Row 11
      cGet1102 := space(10),  ;
      cGet1103 := space(10),  ;
      cGet1104 := space(10),  ;
      cGet1105 := space(10)
local oCrsHand

DEFINE CURSOR oCrsHand HAND
   oWnd = TMyWindow():New( 0, 0, 25, 70, "Scroll Window",,,,,, .T., .T. )
   
   /*
   define window oWnd from 0, 0 TO 25, 70 ;
         title "Scroll Window"            ;
         vscroll hscroll
   */
     

   @ 9,17 bitmap file "..\bitmaps\pic1.bmp" of oWnd size 120,148 adjust
   @ 9,32 bitmap file "..\bitmaps\pic2.bmp" of oWnd size 120,148 adjust
   @ 9,47 bitmap file "..\bitmaps\pic3.bmp" of oWnd size 120,148 adjust
   @ 9,62 bitmap file "..\bitmaps\pic4.bmp" of oWnd size 120,148 adjust
   @ 9,77 bitmap file "..\bitmaps\pic5.bmp" of oWnd size 120,148 adjust

   @ 21*13,02*8 say "Customer " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 23*13,02*8 say "P.O. #   " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 25*13,02*8 say "Style No." of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 27*13,02*8 say "Fabrics  " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 29*13,02*8 say "Fob      " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 31*13,02*8 say "Q'TY     " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 33*13,02*8 say "DEL.     " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 35*13,02*8 say "MAKER    " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 37*13,02*8 say "QTA      " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 39*13,02*8 say "SIZE     " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 41*13,02*8 say "Size B/D " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 43*13,02*8 say "REMARKS  " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel

   @ 21*13,17*8 say "Venture  " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 21*13,32*8 say "Sears    " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 21*13,47*8 say "Kohl's   " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 21*13,62*8 say "Kiss     " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel
   @ 21*13,77*8 say "K-MART   " of oWnd update color CLR_BLACK,CLR_WHITE size 120,26 border pixel

   //-* Row 1
   @ 23*13,17*8 get cGet0101 size 120,26 of oWnd update pixel
   @ 23*13,32*8 get cGet0102 size 120,26 of oWnd update pixel
   @ 23*13,47*8 get cGet0103 size 120,26 of oWnd update pixel
   @ 23*13,62*8 get cGet0104 size 120,26 of oWnd update pixel
   @ 23*13,77*8 get cGet0105 size 120,26 of oWnd update pixel

   //-* Row 2
   @ 25*13,17*8 get cGet0201 size 120,26 of oWnd update pixel
   @ 25*13,32*8 get cGet0202 size 120,26 of oWnd update pixel
   @ 25*13,47*8 get cGet0203 size 120,26 of oWnd update pixel
   @ 25*13,62*8 get cGet0204 size 120,26 of oWnd update pixel
   @ 25*13,77*8 get cGet0205 size 120,26 of oWnd update pixel

   //-* Row 3
   @ 27*13,17*8 get cGet0301 size 120,26 of oWnd update pixel
   @ 27*13,32*8 get cGet0302 size 120,26 of oWnd update pixel
   @ 27*13,47*8 get cGet0303 size 120,26 of oWnd update pixel
   @ 27*13,62*8 get cGet0304 size 120,26 of oWnd update pixel
   @ 27*13,77*8 get cGet0305 size 120,26 of oWnd update pixel

   //-* Row 4
   @ 29*13,17*8 get cGet0401 size 120,26 of oWnd update pixel
   @ 29*13,32*8 get cGet0402 size 120,26 of oWnd update pixel
   @ 29*13,47*8 get cGet0403 size 120,26 of oWnd update pixel
   @ 29*13,62*8 get cGet0404 size 120,26 of oWnd update pixel
   @ 29*13,77*8 get cGet0405 size 120,26 of oWnd update pixel

   //-* Row 5
   @ 31*13,17*8 get cGet0501 size 120,26 of oWnd update pixel
   @ 31*13,32*8 get cGet0502 size 120,26 of oWnd update pixel
   @ 31*13,47*8 get cGet0503 size 120,26 of oWnd update pixel
   @ 31*13,62*8 get cGet0504 size 120,26 of oWnd update pixel
   @ 31*13,77*8 get cGet0505 size 120,26 of oWnd update pixel

   //-* Row 6
   @ 33*13,17*8 get cGet0601 size 120,26 of oWnd update pixel
   @ 33*13,32*8 get cGet0602 size 120,26 of oWnd update pixel
   @ 33*13,47*8 get cGet0603 size 120,26 of oWnd update pixel
   @ 33*13,62*8 get cGet0604 size 120,26 of oWnd update pixel
   @ 33*13,77*8 get cGet0605 size 120,26 of oWnd update pixel

   //-* Row 7
   @ 35*13,17*8 get cGet0701 size 120,26 of oWnd update pixel
   @ 35*13,32*8 get cGet0702 size 120,26 of oWnd update pixel
   @ 35*13,47*8 get cGet0703 size 120,26 of oWnd update pixel
   @ 35*13,62*8 get cGet0704 size 120,26 of oWnd update pixel
   @ 35*13,77*8 get cGet0705 size 120,26 of oWnd update pixel

   //-* Row 8
   @ 37*13,17*8 get cGet0801 size 120,26 of oWnd update pixel
   @ 37*13,32*8 get cGet0802 size 120,26 of oWnd update pixel
   @ 37*13,47*8 get cGet0803 size 120,26 of oWnd update pixel
   @ 37*13,62*8 get cGet0804 size 120,26 of oWnd update pixel
   @ 37*13,77*8 get cGet0805 size 120,26 of oWnd update pixel

   //-* Row 9
   @ 39*13,17*8 get cGet0901 size 120,26 of oWnd update pixel
   @ 39*13,32*8 get cGet0902 size 120,26 of oWnd update pixel
   @ 39*13,47*8 get cGet0903 size 120,26 of oWnd update pixel
   @ 39*13,62*8 get cGet0904 size 120,26 of oWnd update pixel
   @ 39*13,77*8 get cGet0905 size 120,26 of oWnd update pixel

   //-* Row 10
   @ 41*13,17*8 get cGet1001 size 120,26 of oWnd update pixel
   @ 41*13,32*8 get cGet1002 size 120,26 of oWnd update pixel
   @ 41*13,47*8 get cGet1003 size 120,26 of oWnd update pixel
   @ 41*13,62*8 get cGet1004 size 120,26 of oWnd update pixel
   @ 41*13,77*8 get cGet1005 size 120,26 of oWnd update pixel

   //-* Row 11
   @ 43*13,17*8 get cGet1101 size 120,26 of oWnd update pixel
   @ 43*13,32*8 get cGet1102 size 120,26 of oWnd update pixel
   @ 43*13,47*8 get cGet1103 size 120,26 of oWnd update pixel
   @ 43*13,62*8 get cGet1104 size 120,26 of oWnd update pixel
   @ 43*13,77*8 get cGet1105 size 120,26 of oWnd update pixel


   @ 50,20 button "&Ok" size 80,20 of oWnd   ;
      action (MsgInfo("You click OK button!"),oWnd:End())
   @ 50,40 button "&Cancel" size 80,20 of oWnd  ;
      action (MsgInfo("You click Cancel button!"),oWnd:End())
     
       oWnd:bMMoved    := { |nRow, nCol |;
       iif(lDrag = .t.,;    
       ( Sysrefresh(),;
       (ScrollWindow( oWnd:hWnd, 0,  ;
       ( nRowPos - nRow )*D_HEIGHT,    ;
       0, GetClientRect(oWnd:hWnd) ), nRowPos := nRow), ;
       ScrollWindow( oWnd:hWnd,;
       (nColPos- nCol )*D_WIDTH,0,  ;
       0,GetClientRect(oWnd:hWnd) ),nColPos := nCol ) , ) }
   
   
    //     oWnd:bLButtonUp := { |y,x | msginfo(3) }
    //     oWnd:brClicked  := { |y,x | msginfo(4) }

 oWnd:bMButtonDown := { | nRow, nCol |( oWnd:oCursor := oCrsHand,;
 nRowPos := nRow, nColPos := nCol, lDrag := .T., oWnd:oCursor := oCrsHand) }
 
oWnd:bMButtonUp := { |y,x | oWnd:oCursor := nil,lDrag := .F.  }


   ACTIVATE WINDOW oWnd    ;
      ON INIT ( TScrWnd():New(oWnd,1,40,1,70) )

RETURN( NIL )

CLASS TMyWindow FROM TWindow

   CLASSDATA lRegistered AS LOGICAL

   DATA   bMouseWheel

   METHOD MouseWheel( nKey, nDelta, nXPos, nYPos ) INLINE ;
          If( ::bMouseWheel != nil, Eval( ::bMouseWheel, nKey, nDelta, nXPos, nYPos ),)
   
ENDCLASS  

//============================================================================
// FileName : SCROLL.PRG
// Purpose  :  Windows Scroll Class
// Author   : Eric Yang
// Update History :
//      Date     Contents
//    ---------- ---------------------------------------------------------------
//    1997.02.01
//
//============================================================================
#include "FiveWin.ch"

#ifndef TRUE
   #define TRUE              .T.
   #define FALSE             .F.
#endif

CLASS TScrWnd

   DATA oWnd
   DATA nVPos,nHPos

   METHOD New( oWnd,nV1,nV2,nH1,nH2 ) CONSTRUCTOR
   METHOD SetScroll( nV1,nV2,nH1,nH2 )
   //-*------------------------------------------------------------
   METHOD VScroll()
   METHOD VScrollThumb()
   METHOD VScrollTrack()
   METHOD VScrollPgDown()
   METHOD VScrollPgUp()
   //-*-----------------------------
   METHOD HScroll()
   METHOD HScrollThumb()
   METHOD HScrollTrack()
   METHOD HScrollPgDown()
   METHOD HScrollPgUp()

ENDCLASS

METHOD New( oWnd,nV1,nV2,nH1,nH2 ) CLASS TScrWnd
   ::nVPos := 0
   ::nHPos := 0
   ::oWnd := oWnd
   ::SetScroll( nV1,nV2,nH1,nH2 )
   ::oWnd:bMouseWheel = { | nKey, nDelta, nXPos, nYPos |If( nDelta < 0, ::oWnd:oVScroll:GoDown(), ::oWnd:oVScroll:GoUp() ) }
RETURN Self


METHOD SetScroll( nV1,nV2,nH1,nH2 ) CLASS TScrWnd
LOCAL aCoors1:={},aCoors2:={}
   //--------------------------------------------------
   //-* Vertical Scroll Bar
//   ? ::oWnd:oVSCroll=NIL
   if ::oWnd:oVScroll != NIL
//    ? nV1,nV2
      ::oWnd:oVScroll:SetRange( nV1,nV2 )
      ::nVPos := ::oWnd:oVScroll:GetPos()
      ::oWnd:oVScroll:bGoDown   := {|| ::VScroll() }
      ::oWnd:oVScroll:bGoUp     := {|| ::VScroll() }
      ::oWnd:oVScroll:bPageUp   := {|| ::VScrollPgUp() }
      ::oWnd:oVScroll:bPageDown := {|| ::VScrollPgDown() }
      ::oWnd:oVScroll:bGoTop    := {|| ::VScroll() }
      ::oWnd:oVScroll:bGoBottom := {|| ::VScroll() }
      ::oWnd:oVScroll:nPgStep   := 10
      //::oWnd:oVScroll:lReDraw := TRUE
      ::oWnd:oVScroll:bPos      := {|nPos| ::VScrollThumb(nPos) }
      ::oWnd:oVScroll:bTrack    := {|nPos| ::VScrollTrack(nPos) }
   endif
   //--------------------------------------------------
   //-* Horizontal Scroll Bar
   if ::oWnd:oHScroll != NIL
      ::oWnd:oHScroll:SetRange( nH1,nH2 )
      ::nHPos := ::oWnd:oHScroll:GetPos()
      ::oWnd:oHScroll:bGoDown   := {|| ::HScroll() }
      ::oWnd:oHScroll:bGoUp     := {|| ::HScroll() }
      ::oWnd:oHScroll:bPageUp   := {|| ::HScrollPgUp() }
      ::oWnd:oHScroll:bPageDown := {|| ::HScrollPgDown() }
      ::oWnd:oHScroll:bGoTop    := {|| ::HScroll() }
      ::oWnd:oHScroll:bGoBottom := {|| ::HScroll() }
      ::oWnd:oHScroll:nPgStep   := 10
      //::oWnd:oHScroll:lReDraw := TRUE
      ::oWnd:oHScroll:bPos      := {|nPos| ::HScrollThumb(nPos) }
      ::oWnd:oHScroll:bTrack    := {|nPos| ::HScrollTrack(nPos) }
   endif
   //::oWnd:bKeyChar := {|nKey,nFlags| ScrollKey(nKey) }
   //--------------------------------------------------
RETURN( NIL )

//STATIC FUNCTION ScrollKey(nKey)
   //MsgInfo( "Key : "+str(nKey,10) )
   //if nKey == K_ENTER
   //   goMainDlg:End()
   //   lRetVal := TRUE
   //endif
//RETURN( NIL )

//=================================================================
//-* Vertical Scroll Bar
METHOD VScroll() CLASS TScrWnd
LOCAL nNewPos
   if ::nVPos >= ::oWnd:oVScroll:nMin   ;
      .and. ::nVPos <= ::oWnd:oVScroll:nMax
      nNewPos := ::oWnd:oVScroll:GetPos()
      SysRefresh()

      ScrollWindow( ::oWnd:hWnd, 0,  ;
         (  ::nVPos-nNewPos )*D_HEIGHT,    ;
         0 , GetClientRect(::oWnd:hWnd) )
      ::nVPos := nNewPos
   endif
RETURN( NIL )

METHOD VScrollThumb(nNewPos) CLASS TScrWnd
   if ::nVPos >= ::oWnd:oVScroll:nMin   ;
      .and. ::nVPos <= ::oWnd:oVScroll:nMax
      ::oWnd:oVScroll:SetPos(nNewPos)
      SysRefresh()
      ScrollWindow( ::oWnd:hWnd, 0,  ;
         (::nVPos - nNewPos )*D_HEIGHT,    ;
         0 , GetClientRect(::oWnd:hWnd) )
      ::nVPos := nNewPos
   endif
RETURN( NIL )

METHOD VScrollTrack(nNewPos) CLASS TScrWnd
   if ::nVPos >= ::oWnd:oVScroll:nMin   ;
      .and. ::nVPos <= ::oWnd:oVScroll:nMax
      ::oWnd:oVScroll:SetPos(nNewPos)
      SysRefresh()
      ScrollWindow( ::oWnd:hWnd, 0,  ;
         (::nVPos - nNewPos )*D_HEIGHT,    ;
         0 , GetClientRect(::oWnd:hWnd) )
      ::nVPos := nNewPos
   endif
RETURN( NIL )

METHOD VScrollPgDown() CLASS TScrWnd
LOCAL nNewPos
   if ::nVPos < ::oWnd:oVScroll:nMax
      nNewPos := ::nVPos + ::oWnd:oVScroll:nPgStep
      nNewPos := iif(nNewPos > ::oWnd:oVScroll:nMax, ::oWnd:oVScroll:nMax, nNewPos)
      SysRefresh()
      ScrollWindow( ::oWnd:hWnd, 0,  ;
         ( ::nVPos - nNewPos )*D_HEIGHT,    ;
         0 , GetClientRect(::oWnd:hWnd) )
      ::nVPos := nNewPos
   endif
RETURN( NIL )

METHOD VScrollPgUp() CLASS TScrWnd
LOCAL nNewPos
   if ::nVPos > ::oWnd:oVScroll:nMin
      nNewPos := ::nVPos - ::oWnd:oVScroll:nPgStep
      nNewPos := iif(nNewPos < ::oWnd:oVScroll:nMin,::oWnd:oVScroll:nMin,nNewPos)
      SysRefresh()
      ScrollWindow( ::oWnd:hWnd, 0,  ;
         ( ::nVPos - nNewPos )*D_HEIGHT,    ;
         0 , GetClientRect(::oWnd:hWnd) )
      ::nVPos := nNewPos
   endif
RETURN( NIL )

//=================================================================
//-* Horizontal Scroll Bar
METHOD HScroll() CLASS TScrWnd
LOCAL nNewPos
   if ::nHPos >= ::oWnd:oHScroll:nMin   ;
      .and. ::nHPos <= ::oWnd:oHScroll:nMax
      nNewPos := ::oWnd:oHScroll:GetPos()
      SysRefresh()
      ScrollWindow( ::oWnd:hWnd,           ;
         (::nHPos - nNewPos )*D_WIDTH,0,   ;
         0 , GetClientRect(::oWnd:hWnd) )
      ::nHPos := nNewPos
   endif
RETURN( NIL )

METHOD HScrollThumb(nNewPos) CLASS TScrWnd
   if ::nHPos >= ::oWnd:oHScroll:nMin   ;
      .and. ::nHPos <= ::oWnd:oHScroll:nMax
      ::oWnd:oHScroll:SetPos(nNewPos)
      SysRefresh()
      ScrollWindow( ::oWnd:hWnd,           ;
         (::nHPos - nNewPos )*D_WIDTH,0,   ;
         0 , GetClientRect(::oWnd:hWnd) )
      ::nHPos := nNewPos
   endif
RETURN( NIL )

METHOD HScrollTrack(nNewPos) CLASS TScrWnd
   if ::nHPos >= ::oWnd:oHScroll:nMin   ;
      .and. ::nHPos <= ::oWnd:oHScroll:nMax
      ::oWnd:oHScroll:SetPos(nNewPos)
      SysRefresh()
      ScrollWindow( ::oWnd:hWnd,           ;
         (::nHPos - nNewPos )*D_WIDTH,0,   ;
         0 , GetClientRect(::oWnd:hWnd) )
      ::nHPos := nNewPos
   endif
RETURN( NIL )

METHOD HScrollPgDown() CLASS TScrWnd
LOCAL nNewPos
   if ::nHPos < ::oWnd:oHScroll:nMax
      nNewPos := ::nHPos + ::oWnd:oHScroll:nPgStep
      nNewPos := iif(nNewPos > ::oWnd:oHScroll:nMax, ::oWnd:oHScroll:nMax, nNewPos)
      SysRefresh()
      ScrollWindow( ::oWnd:hWnd,           ;
         ( ::nHPos - nNewPos )*D_WIDTH,0,  ;
         0 , GetClientRect(::oWnd:hWnd) )
      ::nHPos := nNewPos
   endif
RETURN( NIL )

METHOD HScrollPgUp() CLASS TScrWnd
LOCAL nNewPos
   if ::nHPos > ::oWnd:oHScroll:nMin
      nNewPos := ::nHPos - ::oWnd:oHScroll:nPgStep
      nNewPos := iif(nNewPos < ::oWnd:oHScroll:nMin,::oWnd:oHScroll:nMin,nNewPos)
      SysRefresh()
      ScrollWindow( ::oWnd:hWnd,           ;
         ( ::nHPos - nNewPos )*D_WIDTH,0,  ;
         0 , GetClientRect(::oWnd:hWnd) )
      ::nHPos := nNewPos
   endif
RETURN( NIL )

//=* End of File =================================================

procedure AppSys   // Xbase++ requirement

return
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: Move the dialog with a Hand

Postby Silvio » Mon Mar 16, 2009 10:13 am

Thanks Otto,
it is the method I wanted but
I use a Dialog style nOR( WS_CHILD, 4 ) in a Main window
I used it on my dialog an run ok
BUt I try to move the dialog it run and then it make an error

Application
===========
Path and name: C:\work\rivamania\RIVAMANIA.Exe (32 bits)
Size: 3,046,400 bytes
Time from start: 0 hours 0 mins 30 secs
Error occurred at: 16/03/2009, 11:25:55
Error description: Error BASE/1005 Class: 'LOGICAL' has no property: OCURSOR
Args:
[ 1] = L .F.
[ 2] = U
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Move the dialog with a Hand

Postby Otto » Mon Mar 16, 2009 10:27 am

Please send me a example-code from you.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: Move the dialog with a Hand

Postby Silvio » Mon Mar 16, 2009 10:31 am

Sorry I found the error
it run ok now BUt if you try it after some seconds the dialog not show all the controls
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Move the dialog with a Hand

Postby Silvio » Mon Mar 16, 2009 11:56 am

I sent
remember the second mail !!
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 86 guests