I want stop the buttonbar

I want stop the buttonbar

Postby Silvio » Tue Mar 10, 2009 4:51 pm

I made a test
Code: Select all  Expand view
#Include "FiveWin.Ch"


#define D_WIDTH           4
#define D_HEIGHT         13


Static oScrWnd


Function Main()
 Local oDlg
 DEFINE DIALOG oDlg  from 10,5 to 70,150  Title "Creazione della spiaggia : numero di File :"
 
ACTIVATE DIALOG oDlg CENTERED;
  ON INIT (crea_bar(oDlg,aItems,aBitmaps), ;
          oScrWnd:=TScrWnd():New(oDlg,1,1300,1,1500)   )






function crea_bar(oDlg,aItems,aBitmaps)
   Local oBar
   Local oItems


   DEFINE BUTTONBAR oBar OF oDlg SIZE 60, 60 2007
 


   return nil



//============================================================================
// 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 )
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 )







 


It run ok BUT
How I can to fix the button bar when I press vertical and Horizontal scroll ?
Best Regards, Saludos

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

Re: I want stop the buttonbar

Postby mmercado » Tue Mar 10, 2009 7:09 pm

Silvio wrote:How I can to fix the button bar when I press vertical and Horizontal scroll ?

Hi Silvio:

Try with oDlg:oTop := oBar

Regards.

Manuel Mercado.
manuelmercado at prodigy dot net dot mx
User avatar
mmercado
 
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Re: I want stop the buttonbar

Postby Silvio » Tue Mar 10, 2009 11:48 pm

NOT Run
when I press vertical and Horizontal scroll the buttonbar was moving
Best Regards, Saludos

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

Re: I want stop the buttonbar

Postby StefanHaupt » Wed Mar 11, 2009 9:45 am

Silvio,

just an idea, try to decrease the scroll area

Code: Select all  Expand view
ACTIVATE DIALOG oDlg CENTERED;
  ON INIT (crea_bar(oDlg,aItems,aBitmaps), ;
          oScrWnd:=TScrWnd():New(oDlg, oBar:nHeight+2, 1300, 1, 1500)   )
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: I want stop the buttonbar

Postby Silvio » Wed Mar 11, 2009 10:20 am

Application
===========
Path and name: C:\work\UGO2\test.Exe (32 bits)
Size: 1,745,920 bytes
Time from start: 0 hours 0 mins 10 secs
Error occurred at: 03/11/09, 11:20:28
Error description: Error BASE/1004 Class: 'NIL' has no exported method: NHEIGHT
Args:
Best Regards, Saludos

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

Re: I want stop the buttonbar

Postby StefanHaupt » Wed Mar 11, 2009 10:25 am

Code: Select all  Expand view
ACTIVATE DIALOG oDlg CENTERED;
  ON INIT (oBar := crea_bar(oDlg,aItems,aBitmaps), ;
          oScrWnd:=TScrWnd():New(oDlg, oBar:nHeight+2, 1300, 1, 1500)   )
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: I want stop the buttonbar

Postby Silvio » Wed Mar 11, 2009 10:56 am

not tun!! allready try this information
Application
===========
Path and name: C:\work\UGO2\test.Exe (32 bits)
Size: 1,745,920 bytes
Time from start: 0 hours 0 mins 7 secs
Error occurred at: 03/11/09, 11:56:58
Error description: Error BASE/1004 Class: 'NIL' has no exported method: NHEIGHT
Args:
[ 1] = U

Stack Calls
===========
Called from: => NHEIGHT(0)
Called from: final.prg => (b)EDITOR(137)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:INITIATE(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT(0)
Called from: => DIALOGBOXINDIRECT(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(0)
Called from: final.prg => EDITOR(137)
Called from: final.prg => MAIN(64)
Best Regards, Saludos

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

Re: I want stop the buttonbar

Postby StefanHaupt » Thu Mar 12, 2009 8:36 am

oBar is nil at that point, because your function crea_bar() returns nil instead of oBar. Can you check this please
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: I want stop the buttonbar

Postby Silvio » Thu Mar 12, 2009 10:06 am

return oBar

ok!

But when I press scroll the buttonbar was moving also
Best Regards, Saludos

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

Re: I want stop the buttonbar

Postby StefanHaupt » Fri Mar 13, 2009 8:42 am

Try to increase the height

Code: Select all  Expand view
ACTIVATE DIALOG oDlg CENTERED;
  ON INIT (oBar := crea_bar(oDlg,aItems,aBitmaps), ;
          oScrWnd:=TScrWnd():New(oDlg, oBar:nHeight*2+2, 1300, 1, 1500)   )
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: I want stop the buttonbar

Postby Silvio » Sat Mar 14, 2009 12:48 am

not run
Best Regards, Saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 41 guests