Array of Gets on a scroll panel

Array of Gets on a scroll panel

Postby betoncu » Wed Mar 24, 2021 6: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: Select all  Expand view
#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
User avatar
betoncu
 
Posts: 126
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Re: Array of Gets on a scroll panel

Postby betoncu » Thu Mar 25, 2021 8: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
User avatar
betoncu
 
Posts: 126
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Re: Array of Gets on a scroll panel

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42076
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Array of Gets on a scroll panel

Postby nageswaragunupudi » Thu Mar 25, 2021 10:24 am

We'll check.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Array of Gets on a scroll panel

Postby nageswaragunupudi » Fri Mar 26, 2021 7:58 am

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Array of Gets on a scroll panel

Postby nageswaragunupudi » Fri Mar 26, 2021 8:01 am

Please replace these two methods in TScrollPanel class

Code: Select all  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Array of Gets on a scroll panel

Postby Silvio.Falconi » Fri Mar 26, 2021 8: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

Image

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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: Array of Gets on a scroll panel

Postby betoncu » Sat Mar 27, 2021 7: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: Select all  Expand view
#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
User avatar
betoncu
 
Posts: 126
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Re: Array of Gets on a scroll panel

Postby betoncu » Sat Mar 27, 2021 7: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
User avatar
betoncu
 
Posts: 126
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Re: Array of Gets on a scroll panel

Postby nageswaragunupudi » Sat Mar 27, 2021 8:10 am

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Array of Gets on a scroll panel

Postby betoncu » Sat Mar 27, 2021 8:28 am

Ok. But it is not highlighted when focused.
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
User avatar
betoncu
 
Posts: 126
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 112 guests