FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Array of Gets on a scroll panel
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
Array of Gets on a scroll panel
Posted: Wed Mar 24, 2021 06:08 AM
Hi, I have five gets placed on a scrolling panel,
Initially all of them are disabled.
When I enable all of them (except third one) by using the function ChangeWhen, everything is OK. It works well.
But when I try to skip on the gets by hitting ENTER or TAB key, I cannot skip the third one which is disabled.

Please help.


Code (fw): Select all Collapse
#include "fivewin.ch"
#INCLUDE "dtpicker.ch"

FUNCTION Main()
LOCAL oDlg, oFolder, aSayGet := {}, aGets := {}

   AAdd(aSayGet, {'Field-1 :', PadR('Field-1', 40), 200} )
   AAdd(aSayGet, {'Field-2 :', PadR('Field-2', 40), 200} )
   AAdd(aSayGet, {'Field-3 :', PadR('Field-3', 40), 200} )
   AAdd(aSayGet, {'Field-4 :', PadR('Field-4', 40), 200} )
   AAdd(aSayGet, {'Field-5 :', PadR('Field-5', 40), 200} )

   DEFINE DIALOG oDlg SIZE 500,400 PIXEL TRUEPIXEL

   @ 10, 10 FOLDEREX oFolder PROMPT "&First", "&Second", "&Third" OF oDlg SIZE 480, 380 PIXEL
   oFolder:aEnable := { .T., .F., .F. }


   @ 20, 20 BUTTON 'Next >' SIZE 30, 13 PIXEL OF oFolder:aDialogs[1] ;
            ACTION ( oFolder:aEnable := { .F., .T., .F. }, ;
                     oFolder:SetOption(2), ;
                     ChangeWhen(@aGets), ;  //Call the function to change the When clauses to .T.
                     oDlg:UpDate() )


   ACTIVATE DIALOG oDlg CENTERED ;
            ON INIT  PlaceControls(@oDlg, @oFolder, @aSayGet, @aGets) ;
            ON PAINT  aGets[1]:SetFocus()

RETURN NIL


FUNCTION PlaceControls(oDlg, oFolder, aSayGet, aGets)
LOCAL oPanel, nI, nRow, aGetObj[ Len(aSayGet) ]

   oPanel := TScrollPanel():New( 0, 0, 195, 470, oFolder:aDialogs[2], .T. )
   oFolder:aDialogs[2]:oClient := oPanel

   nRow:= 10

   FOR nI=1 to Len(aSayGet)
   
      @ nRow,  20 SAY aSayGet[nI, 1] OF oPanel SIZE 100,21 PIXEL RIGHT TRANSPARENT

      @ nRow, 125 GET aGetObj[nI] VAR aSayGet OF oPanel SUBSCRIPT nI, 2 SIZE aSayGet[nI, 3], 21 PIXEL WHEN .F.  //Initially disabled
      
      AAdd( aGets, aGetObj[nI] )

      nRow += 23
   NEXT

   oPanel:SetRange()

RETURN NIL


FUNCTION ChangeWhen(aGets)
LOCAL nI

   FOR nI = 1 TO Len(aGets)
      IF nI <> 3
         aGets[nI]:bWhen := {|| .T.}   //Change bWhen clause of all gets to .T. except third element
      ENDIF
   NEXT

RETURN NIL
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
Re: Array of Gets on a scroll panel
Posted: Thu Mar 25, 2021 08:02 AM

Mr. Rao. Do you have any advise about this problem. Please

Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Array of Gets on a scroll panel
Posted: Thu Mar 25, 2021 10:20 AM

Birol,

If you remove the TScrollPanel then it works as expected

it seems as a bug to be fixed with TScrollPanel

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Array of Gets on a scroll panel
Posted: Thu Mar 25, 2021 10:24 AM

We'll check.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Array of Gets on a scroll panel
Posted: Fri Mar 26, 2021 07:58 AM

When clause is not handled by ScrollPanel. This is a bug.
Fixed in next version.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Array of Gets on a scroll panel
Posted: Fri Mar 26, 2021 08:01 AM
Please replace these two methods in TScrollPanel class

Code (fw): Select all Collapse
METHOD GoNextCtrl( hCtrl ) CLASS TScrollPanel

   local nAt, hNext
   local nNext := 0

   nAt := AScan( ::aControls, { | o | o:hWnd == hCtrl } )
   if nAt > 0
      hNext    := NextDlgTab( ::hWnd, hCtrl )
      nNext    := AScan( ::aControls, { |o| o:hWnd == hNext } )
      ::hCtlFocus := hCtrl
      if nNext < nAt .and. Len( ::oWnd:aControls ) > 1
         ::oWnd:GoNextCtrl( ::hWnd )
      else
         SetFocus( hNext )
      endif
   endif

return nil

//----------------------------------------------------------------------------//

METHOD GoPrevCtrl( hCtrl ) CLASS TScrollPanel

   local nAt, hPrev
   local nPrev := 0

   nAt := AScan( ::aControls, { | o | o:hWnd == hCtrl } )
   if nAt > 0
      hPrev    := NextDlgTab( ::hWnd, hCtrl, .t. )
      nPrev    := AScan( ::aControls, { |o| o:hWnd == hPrev } )
      ::hCtlFocus := hCtrl
      if ( nPrev == 0 .or. nPrev > nAt ) .and. Len( ::oWnd:aControls ) > 1
         ::oWnd:GoPrevCtrl( ::hWnd )
      else
         SetFocus( hPrev )
      endif
   endif

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: Array of Gets on a scroll panel
Posted: Fri Mar 26, 2021 08:55 AM
Nages,
when I use the scrollpanel in a dialog sized by the user (oDlg: bResized), the objects contained in it do not refresh themselves, i.e. they always have their own configuration,

for example



if the user shrinks the dialog the btnbmp do not align according to the size of the dialog and at the same time of the resized control (scrpanel)

that is, if from the program I gave it the configuration to create files of 6 buttons, when the user resizes the dialog, the rows for 6 buttons will remain

Is it possible to have a horizontal scroll as well?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
Re: Array of Gets on a scroll panel
Posted: Sat Mar 27, 2021 07:10 AM
Thank you very much. It works.
There is only one problem left. I use SetGetColorFocus() to change get color when focused.
The color of the get does not change when I use dtpicker.

Thanks in advance.


Code (fw): Select all Collapse
#include "fivewin.ch"
#INCLUDE "dtpicker.ch"

FUNCTION Main()
LOCAL oDlg, oFolder, aSayGet := {}, aGets := {}

   SetGetColorFocus()

   AAdd(aSayGet, {'Field-1 :', 'C', PadR('Field-1', 40), 200,         '@!'} )
   AAdd(aSayGet, {'Field-2 :', 'N',              234.45, 100, '999,999.99'} )
   AAdd(aSayGet, {'Field-3 :', 'D',              Date(), 100,          NIL} )
   AAdd(aSayGet, {'Field-4 :', 'C', PadR('Field-4', 40), 200,         '@!'} )
   AAdd(aSayGet, {'Field-5 :', 'N',                   0, 100, '999,999.99'} )

   DEFINE DIALOG oDlg SIZE 500,400 PIXEL TRUEPIXEL

   @ 10, 10 FOLDEREX oFolder PROMPT "&First", "&Second", "&Third" OF oDlg SIZE 480, 380 PIXEL
   oFolder:aEnable := { .T., .F., .F. }

   ACTIVATE DIALOG oDlg CENTERED ;
            ON INIT  PlaceControls(@oDlg, @oFolder, @aSayGet, @aGets) ;
            ON PAINT  aGets[1]:SetFocus()

RETURN NIL



FUNCTION PlaceControls(oDlg, oFolder, aSayGet, aGets)
LOCAL oPanel, nI, nRow, oGet

   oPanel := TScrollPanel():New( 0, 0, 195, 470, oFolder:aDialogs[1], .T. )
   oFolder:aDialogs[1]:oClient := oPanel

   nRow:= 10

   FOR nI = 1 to Len(aSayGet)

      @ nRow, 005 SAY aSayGet[nI, 1] OF oPanel SIZE 150, 22 PIXEL RIGHT TRANSPARENT

      oGet := CreateGet(oPanel, nRow, 160, aSayGet, nI)

      AAdd(aGets, oGet )

      nRow += 25
   NEXT

   oPanel:SetRange()

RETURN NIL


FUNCTION CreateGet(oDlg, nRow, nCol, aSayGet, nI)
LOCAL oGet

   IF aSayGet[nI, 2] == 'D'
      @ nRow, nCol DTPICKER oGet VAR aSayGet[nI, 3] OF oDlg SIZE aSayGet[nI, 4], 22 PIXEL
   ELSE
      @ nRow, nCol GET oGet VAR aSayGet[nI, 3] OF oDlg SIZE aSayGet[nI, 4], 22 PIXEL UPDATE PICTURE aSayGet[nI, 5]
   ENDIF

RETURN oGet
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
Re: Array of Gets on a scroll panel
Posted: Sat Mar 27, 2021 07:23 AM

Also, when I click on dtpicker to change the day, month or year manually, it does not focused. It acts as it is readonly.
If I use WindowsXP.Manifest, I can solve this problem. It is focused and does not acts as readonly when I click on it.

Only highlighting problem left now. When I use tabs to skip amoung the gets, dtpicker does not highlighted.

Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Array of Gets on a scroll panel
Posted: Sat Mar 27, 2021 08:10 AM

SetGetColorFocus() works for Gets only. Not for dtpicker.

Regards



G. N. Rao.

Hyderabad, India
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
Re: Array of Gets on a scroll panel
Posted: Sat Mar 27, 2021 08:28 AM

Ok. But it is not highlighted when focused.

Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7

Continue the discussion