TGraph on a folder tab from resource file

TGraph on a folder tab from resource file

Postby PatrickWeisser » Sun Oct 05, 2008 8: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!
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby reinaldocrespo » Sun Oct 05, 2008 10:10 pm

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



Try changing "Tgraph" to "Static". See if that helps.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Postby Antonio Linares » Sun Oct 05, 2008 11:09 pm

Patrick,

Have you implemented:
Code: Select all  Expand view
REDEFINE GRAPH oGraph ID 120 OF oFld:aDialogs[ 2 ]

from your PRG ?
regards, saludos

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

TGraph on a folder tab from resource file

Postby PatrickWeisser » Mon Oct 06, 2008 8: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:

Code: Select all  Expand view
// 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!
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby Antonio Linares » Mon Oct 06, 2008 8:21 am

Patrick,

Glad to know that it is working fine :-)

Thanks for your example, very nice!

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
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 87 guests