Dialogo con campos con scroll automatico

Dialogo con campos con scroll automatico

Postby carito » Wed Mar 06, 2019 3:56 pm

Hola Foro,

Requiero una ayuda, alguien sabe como poner en un dialogo una lista de campos editables, pero si
estos son muchos, deseo que estos campos se desplacen hacia arriba. Cuando la lista de campos
se mayor al alto definido en el dialogo inicial.

Recuerdo que tiempo atras, Antonio puso un ejemplo, pero no lo he podido encontrar en el foro.

Si alguien tiene alguna idea , ejemplo o sabe donde estar, lo agradeceria mucho.

Saludos,
carito
 
Posts: 85
Joined: Sat Dec 03, 2016 2:49 pm

Re: Dialogo con campos con scroll automatico

Postby karinha » Wed Mar 06, 2019 4:38 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Dialogo con campos con scroll automatico

Postby carito » Wed Mar 06, 2019 5:58 pm

Muchas gracias Karinha, partire mirando lo que me señalas.
carito
 
Posts: 85
Joined: Sat Dec 03, 2016 2:49 pm

Re: Dialogo con campos con scroll automatico

Postby nageswaragunupudi » Sat Mar 09, 2019 3:09 pm

FWH provides TScrollPanel class specifically for this purpose. This class was first introduced in FWH1204 and improved in later versions.

The default edit dialog of TDataRow class (introduced in FWH1305) uses the TScrollPanel. To see the functionality, please try this single line test program.
Code: Select all  Expand view

XBROWSER "c:\fwh\samples\diario.dbf" FASTEDIT // or any dbf with many fields
 

Click on Add or Edit button to see the scrolling dialog.

Image

The next program shows how to program a dialog with scroll panel.
Code: Select all  Expand view
#include "fivewin.ch"

REQUEST DBFCDX

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

function Main()

   local oRec

   SetGetColorFocus()
   SET DATE ITALIAN
   SET CENTURY ON
   RDDSETDEFAULT( "DBFCDX" )

   USE CUSTOMER NEW SHARED
   GOTO 10 // any record to be edited

   oRec  := TDataRow():New( "CUSTOMER" )

   EditDialog( oRec )

   CLOSE DATA

return nil

function EditDialog( oRec )

   local oDlg, oFont, oBold, oPanel
   local lNew  := ( oRec:RecNo == 0 )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-14 BOLD

   DEFINE DIALOG oDlg SIZE 500,400 PIXEL TRUEPIXEL FONT oFont ;
      TITLE "FWH TScrollPanel"

   @ 20,20 SAY If( oRec:RecNo == 0, "ADD CUSTOMER", "EDIT CUSTOMER : " + STRZERO( oRec:RecNo, 3 ) ) ;
      SIZE 460,24 PIXEL OF oDlg CENTER UPDATE FONT oBold

   //
   oPanel   := TScrollPanel():New( 60, 20, 300, 480, oDlg, .t. )
   oPanel:SetFont( oDlg:oFont )
   //

   @ 340,020 BUTTON "SAVE"   SIZE 100,40 PIXEL OF oDlg ACTION ( oRec:Save(), oDlg:End() )
   @ 340,380 BUTTON "CANCEL" SIZE 100,40 PIXEL OF oDlg ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED ON INIT ( PlaceControls( oPanel, oRec ) ) ;
      ON PAINT oDlg:Box( 59, 19, 302, 490 )

   RELEASE FONT oFont, oBold

return nil

function PlaceControls( oPanel, oRec )

   local nRow  := 30

   @ nRow,  20 SAY "First :"  SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
   @ nRow, 110 GET oRec:First SIZE 300,24 PIXEL OF oPanel

   nRow  += 30
   @ nRow,  20 SAY "Last :"   SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
   @ nRow, 110 GET oRec:Last  SIZE 300,24 PIXEL OF oPanel

   nRow  += 30
   @ nRow,  20 SAY "Street :"   SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
   @ nRow, 110 GET oRec:Street  SIZE 300,24 PIXEL OF oPanel

   nRow  += 30
   @ nRow,  20 SAY "City :"   SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
   @ nRow, 110 GET oRec:City  SIZE 300,24 PIXEL OF oPanel

   nRow  += 30
   @ nRow,  20 SAY "State :"   SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
   @ nRow, 110 GET oRec:State  SIZE 300,24 PIXEL OF oPanel

   nRow  += 30
   @ nRow,  20 SAY "Zip :"   SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
   @ nRow, 110 GET oRec:Zip  SIZE 300,24 PIXEL OF oPanel

   nRow  += 30
   @ nRow,  20 SAY "HireDate :"   SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
   @ nRow, 110 GET oRec:HireDate  SIZE 300,24 PIXEL OF oPanel

   nRow  += 30
   @ nRow,  20 SAY "Married :"   SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
   @ nRow, 110 CHECKBOX oRec:Married PROMPT "" SIZE 24,24 PIXEL OF oPanel

   nRow  += 30
   @ nRow,  20 SAY "Age :"   SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
   @ nRow, 110 GET oRec:Age  SIZE 040,24 PIXEL OF oPanel PICTURE "99" RIGHT

   nRow  += 30
   @ nRow,  20 SAY "Salary :"   SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
   @ nRow, 110 GET oRec:Salary  SIZE 100,24 PIXEL OF oPanel PICTURE "999,999.99" RIGHT

   nRow  += 30
   @ nRow,  20 SAY "Notes :"   SIZE 080,24 PIXEL OF oPanel RIGHT TRANSPARENT
   @ nRow, 110 GET oRec:Notes  SIZE 300,24 PIXEL OF oPanel

   oPanel:SetRange() // call this after defining all controls

return nil
 


Image
Regards

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

Re: Dialogo con campos con scroll automatico

Postby carito » Mon Mar 11, 2019 2:19 pm

Mr. Rao MUCHAS GRACIAS !!

Eso es justo lo que necesito.., pues los datos de edicion del dialogo , dependeran , de las columnas
que tenga el archivo a leer.

Saludos,
Carito
carito
 
Posts: 85
Joined: Sat Dec 03, 2016 2:49 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 78 guests