button move on the dialog

button move on the dialog

Postby Silvio » Tue Aug 19, 2008 12:24 pm

I made a dialog with scroll (thanks to Emg) because my tpanelscroll not run also.
Now I have a problem
On my dialog there are :
a big button on the top
ten small buttons down the big button

moving the scrollbar i want move the buttons but the button overwrite on the big button

How I can make to hide the button when they are on big button ?

look this the source test
Code: Select all  Expand view  RUN
#include "FiveWin.ch"


Function test()
     LOCAL oDlg
     LOCAL i
     Local abtn[10]

DEFINE DIALOG oDlg;
         SIZE 800,600

  @  2,5 BUTTON OBTN1  PROMPT "move the scrollbar but the buttons must not overwrite here" SIZE 380,45 OF  oDlg PIXEL

  FOR i = 1 TO 10
     CREAPULSANTI( aBtn, i )
  NEXT


  oDlg:nStyle = NOR( oDlg:nStyle, WS_VSCROLL )

  ACTIVATE DIALOG oDlg;
           ON INIT IMPOSTASCROLL( oDlg, 5 );
           CENTER



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

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

    RETURN NIL


STATIC FUNCTION SPOSTACONTROLLI( 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 )
      NEXT
      oDlg:Refresh()
  RETURN NIL

STATIC FUNCTION CREAPULSANTI( aBtn, nBtn )

     @ 40 + ( nBtn - 1 ) * 20, 120 BUTTON abtn[nBtn] PROMPT "TAVOLO" + STR( nBtn, 2 ) PIXEL
     abtn[nBtn]:cToolTip  :="TAVOLO" + STR( nBtn, 2 )
     abtn[nBtn]:CARGO:= { 'Libero', nBtn }
    RETURN NIL



thanks
Best Regards, Saludos

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

Postby gkuhnert » Tue Aug 19, 2008 2:32 pm

Silvio,

this should work: (in the function SPOSTACONTROLLI)

Code: Select all  Expand view  RUN
     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 + 50 > oDlg:aControls[i]:nTop
        oDlg:aControls[i]:hide()
      else
        oDlg:aControls[i]:show()
      endif
    NEXT


But I don't know, why +50 is necessary...
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Postby Silvio » Tue Aug 19, 2008 4:40 pm

goooooooood resolved !!!!
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 89 guests