Problem using a Class

Started by Charles Dietz, January 14, 2009, 08:40:52 PM

Previous topic - Next topic

Charles Dietz

I have a control written in PB9 DDT that I am trying to carry over into Firefly.  It is simply a listbox with label headers for column titles which can be clicked for sorting.  This control is defined in an include file and employs a CLASS, mainly for data encapsulation.   The control has been very handy using DDT style coding.

To get started, I have simply created a window in Firefly, just to call my control.
I am having a problem with the first statement inside Sub FORM1_CreateControls(). 

Let oColList = Class "cColumnList"

The error points to oColList, but the Class has been defined in the include file which is loaded in CODEGEN_PROJECT1_MAIN.bas.

Error 516 - DEFtype, Type ID or type-specifier required
DEFtype, Type ID or type-specifier (?%&!#$), or AS ... required - A variable with no type declaration was found and no DEFtype statement (such as DEFINT) was found.

I have checked the compiler defaults and C:\PBWin90\Bin\ is called for.  Any one see what I am doing wrong.
   

TechSupport

How are you #INCLUDING the file? Are you putting it at the top of your main form or in the "user_includes.inc" file?

Try moving your #Include to the "user_includes.inc" file. If you are not using the "user_includes.inc" file, I wonder if the FireFly forward referencing algorithm is screwing things up.


Charles Dietz

Paul, I am not familiar with the "user_includes.inc" you spoke of.  As far as I know, it is not being used.  The top of my "CODEGEN_PROJECT1_MAIN.bas" file is as follows:

'------------------------------------------------------------------------------
' Source code generated by FireFly Visual Designer Version: 2.91
' Generated: Saturday  January 03, 2009 at 11:38:07 AM
' Visit www.planetsquires.com for more information
'------------------------------------------------------------------------------

#IF 0
//FF_WRAPPERS//

//FF_WRAPPERS//
//FF_DECLARES//
Declare Function WinMain (ByVal hInstance     As Dword, _
                  ByVal hPrevInstance As Dword, _
                  ByVal lpCmdLine     As Asciiz Ptr, _
                  ByVal iCmdShow      As Long) As Long
Declare Function FF_WINMAIN(ByVal hInstance     As Dword, _
                    ByVal hPrevInstance As Dword, _
                    ByVal lpCmdLine     As Asciiz Ptr, _
                    ByVal iCmdShow      As Long) As Long
Declare Function FF_PUMPHOOK(Msg As tagMsg) As Long
Declare Sub FF_InitializeVariables()   
Declare Sub FF_SetAppVariables()   
Declare Function FF_EnumSysColorChangeProc(ByVal hWnd As Dword, lParam As Long) As Long

//FF_DECLARES//
#ENDIF

#Compile EXE "C:\PBWin90\Library List - Firefly\Project1.exe"



#Include "ColumnListClass.inc"

#Include "Win32API.inc"
#Include "COMDLG32.INC"
#Include "COMMCTRL.INC"


TechSupport

Hi Charles,

You must have manually added the #Include "ColumnListClass.inc" to the generated source code for the main *.bas file? People do not normally do that. It is a pain to have to manually enter code because you will need to do so every time the project is compiled.

Here is a bit of a hack that works. You need to create a simple text file (called "User_Includes.inc") and place it in the same directory as your Project. You should use JellyFish or the PB IDE to create the file. You can then place your #Include statements in that file. FireFly will search for that file during code generation and add a reference to that file in the FireFly generated code automatically.

Worse case scenario, maybe you can email me the class and I will work throught the interaction with FireFly to find out exactly why and where the problem occurs.

Thanks!


TechSupport

Hi Charles,

I received your project via email. I will respond to you via email as well. I just wanted to post here to indicate to other FireFly users that the problems that Charles is experiencing is not FireFly related but rather to the way that he chose to write the Class.