FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TGraph on a folder tab from resource file
Posts: 53
Joined: Fri Mar 23, 2007 04:10 AM
TGraph on a folder tab from resource file
Posted: Sun Oct 05, 2008 08:52 PM

Hello Everyone,

I'm trying to create a TGraph control on a Folder (tab) that's defined in a resource file. Using the TestFold.prg sample program as a starting point, I modified the Sub2 tab in TestFold.rc to be:

sub2 DIALOG 18, 18, 142, 67
STYLE WS_CHILD | 4
{
CONTROL "", 120, "TGraph", 0x00000000, 3, 15, 260, 135
}

This was based on a suggestion by Stefan Haupt in a September 13th post concerning TGraph and resource files. But with the above change, I get the following runtime error:

Error description: Error FiveWin/3 Cannot create Dialog Box:
Resource: Sub2

Does anyone know the proper way to do this? The main thing is getting a TGraph control on a folder tab. I would be fine with doing it in code if using a resource file presents a problem.

Thanks!

Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
TGraph on a folder tab from resource file
Posted: Sun Oct 05, 2008 10:10 PM

CONTROL "", 120, "TGraph", 0x00000000, 3, 15, 260, 135



Try changing "Tgraph" to "Static". See if that helps.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
TGraph on a folder tab from resource file
Posted: Sun Oct 05, 2008 11:09 PM
Patrick,

Have you implemented:
REDEFINE GRAPH oGraph ID 120 OF oFld:aDialogs[ 2 ]

from your PRG ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 53
Joined: Fri Mar 23, 2007 04:10 AM
TGraph on a folder tab from resource file
Posted: Mon Oct 06, 2008 08:08 AM
Thanks Antonio, yes I did forget that. It's all working fine now, and I have a small sample program for reference in case anyone else needs this. The TGraph class is wonderful and I'm going to be using it a lot in my application!

Here is the sample PRG and RC file code:

// TestFld2.prg:

// FiveWin folders with TGraph from resource file.

#include "FiveWin.ch"
#include "Folder.ch"
#include "TGraph.ch"

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

function Main()

   local oDlg, oFld, oCbx, cItem, oGraph

   SET _3DLOOK ON

   DEFINE DIALOG oDlg RESOURCE "Test"

   REDEFINE FOLDER oFld ID 110 OF oDlg ;
      PROMPT "Folder 1", "Graph" ;
      DIALOGS "Sub1", "Sub2"

   oFld:aEnable = { .t., .t. }

   REDEFINE COMBOBOX oCbx VAR cItem ITEMS { "This", "is", "a test" } ;
      ID 100 OF oFld:aDialogs[ 1 ]


   REDEFINE GRAPH oGraph ID 500 TYPE 1 YVALUES 3D XGRID YGRID XVALUES LEGENDS OF oFld:aDialogs[ 2 ]

   oGraph:aSeries = { { "Series 1", CLR_CYAN , , },;
                      { "Series 2", CLR_YELLOW, , .T. },;
                      { "Series 3", CLR_HRED, 3, .F. } }

   oGraph:aYVals = { "Jan", "Feb", "Mar", "Apr", "May" }

   oGraph:aData = { { 14280, 20420, 12870, 25347, 7640 },;
                    { 8350, 10315, 15870, 5347, 12340 },;
                    { 12345, -8945, 10560, 15600, 17610 } }

   oGraph:nClrX = CLR_GREEN
   oGraph:nClrY = CLR_RED


   REDEFINE BUTTON ID 120 OF oDlg ;
      ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED ;
      VALID MsgYesNo( "Want to end ?" )

return nil



// TestFld2.rc:

#include ".\..\include\WinApi.ch"

Test DIALOG 47, 2, 244, 178
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "FiveWin Folders Demo"
{
 CONTROL "", 110, FOLDER32, 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 4, 5, 238, 151
 PUSHBUTTON "&OK", 120, 94, 161, 37, 14
}


sub1 DIALOG 18, 18, 205, 80
STYLE WS_CHILD | 4
{
 GROUPBOX "Group", -1, 7, 5, 140, 31, BS_GROUPBOX
 COMBOBOX 100, 74, 14, 49, 33, CBS_DROPDOWN | WS_TABSTOP
}


sub2 DIALOG 10, 10, 230, 160
STYLE WS_CHILD | 4
{
 CONTROL "", 500, "TGraph", 0 | WS_CHILD | WS_VISIBLE, 10, 10, 220, 120
}


Thanks!
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
TGraph on a folder tab from resource file
Posted: Mon Oct 06, 2008 08:21 AM
Patrick,

Glad to know that it is working fine :-)

Thanks for your example, very nice!

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion