tScrollPanel and Pelles C

tScrollPanel and Pelles C

Postby damianodec » Tue May 04, 2021 2:42 pm

Hi,
In FWH Samples there is dialogscroll.prg for tScrollPanel example but I need to use tScrollPanel inside dialog in my resource file (myrc.res)

how can I to create a dialog with tScrollPanel by Pelles C and then use it by REDEFINE DIALOG inside .prg?

thank you
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: tScrollPanel and Pelles C

Postby Antonio Linares » Tue May 04, 2021 5:21 pm

Damiano,

In your RC include it this way:
CONTROL "", 101, "TScrollPanel", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 10, 200, 200

From the PRG:
oSPanel := TScrollPanel():Redefine( 101, 10, 10, 200, 200, oDlg )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42059
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: tScrollPanel and Pelles C

Postby damianodec » Wed May 05, 2021 9:32 am

hi Antonio,
thisi is dialog in Pelles C
Image

this is my sample code:
Code: Select all  Expand view

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 RESOURCE "SCROOL" FONT oFont;
      TITLE "FWH TScrollPanel"

   //
   oPanel   := TScrollPanel():Redefine( 101, 10, 10, 200, 200, oDlg)
   oPanel:SetFont( oDlg:oFont )
   //


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

   RELEASE FONT oFont, oBold

return nil
 


this is the error log:
Application
===========
Path and name: C:\fwh1709\samples\ddscroll.exe (32 bits)
Size: 3,550,720 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20161218)
FiveWin version: FWHX 17.09
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 0 secs
Error occurred at: 05-05-2021, 11:22:25
Error description: Error BASE/1004 Class: 'NUMERIC' has no exported method: DEFCONTROL
Args:
[ 1] = N 10
[ 2] = O TSCROLLPANEL

Stack Calls
===========
Called from: => DEFCONTROL( 0 )
Called from: .\source\classes\CONTROL.PRG => TSCROLLPANEL:REDEFINE( 1596 )
Called from: ddscroll.prg => EDITDIALOG( 42 )
Called from: ddscroll.prg => MAIN( 21 )
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: tScrollPanel and Pelles C

Postby Antonio Linares » Wed May 05, 2021 7:09 pm

My mistake, you have to call it this way:

// Class TPanel Method Redefine( nId, oWnd, lDesign, cVarName, lBorder )

oPanel := TScrollPanel():Redefine( 101, oDlg )

Also, you have to call oPanel:SetFont( oDlg:oFont ) from the ON INIT clause of the ACTIVATE DIALOG
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42059
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: tScrollPanel and Pelles C

Postby damianodec » Thu May 06, 2021 11:01 am

hi Antonio,
thank you.

Now I have another error.
I'm try to modify dialogscroll.prg in samples folder and I added another editdialog(oRec) istruction:
Code: Select all  Expand view

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

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 )
   EditDialog( oRec ) // <-------------- ADDED ROW
   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 ;
...
 


when I close the first editdialog and start the second I get this error:
Application
===========
Path and name: C:\fwh1709\samples\dialogscroll.exe (32 bits)
Size: 3,549,184 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20161218)
FiveWin version: FWHX 17.09
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 1 secs
Error occurred at: 06-05-2021, 12:55:32
Error description: Error BASE/1004 Class: 'NIL' has no exported method: HBRUSH
Args:
[ 1] = U

Stack Calls
===========
Called from: => HBRUSH( 0 )
Called from: .\source\classes\SCRLPANL.PRG => TSCROLLPANEL:PAINT( 415 )
Called from: .\source\classes\SCRLPANL.PRG => (b)TSCROLLPANEL:TSCROLLPANEL( 72 )
Called from: => TSCROLLPANEL:DISPLAY( 0 )
Called from: .\source\classes\CONTROL.PRG => TSCROLLPANEL:HANDLEEVENT( 1697 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3348 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 296 )
Called from: dialogscroll.prg => EDITDIALOG( 50 )
Called from: dialogscroll.prg => MAIN( 22 )

thank for your help.
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: tScrollPanel and Pelles C

Postby Antonio Linares » Thu May 06, 2021 4:32 pm

Damiano,

Please post the complete code for function EditDialog( oRec )

It seems as oDlg:oBrush has been changed to nil

This little example works fine here, thats why I need to review your code:
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   Dialog()
   Dialog()

return nil

function Dialog()

   local oDlg

   DEFINE DIALOG oDlg

   ACTIVATE DIALOG oDlg CENTERED

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42059
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: tScrollPanel and Pelles C

Postby damianodec » Fri May 07, 2021 10:00 am

hi Antonio,
the sample is dialogscroll.prg in samples folder of FWH:

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 )
   EditDialog( oRec )    //  <---- my add
   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
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: tScrollPanel and Pelles C

Postby Antonio Linares » Fri May 07, 2021 5:58 pm

Damiano,

Please post the contents of dialogscroll.prg here as I can't find it at the FWH\samples folder, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42059
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 31 guests