I have the following code to fill in a listbox that the user can pick from and it will generate a graph based on the item they pick.
For some reason when they pick the last item it seems to loose its pointer.
I traced through the code and watched as it assigned the correct pointer to the object but later in another part of the code when i pull the pointer the pointer is invalid.
Any Ideas?
Thanks, Tom C
Retrieve code when they select an item from the list...
[navy] for automatic syntax highlighting see faq102-6487
[/navy]
For some reason when they pick the last item it seems to loose its pointer.
I traced through the code and watched as it assigned the correct pointer to the object but later in another part of the code when i pull the pointer the pointer is invalid.
Any Ideas?
Thanks, Tom C
Code:
GraphData.DBFData.GoTop;
getmem(tmpPtr, [purple]17[/purple]);
strcopy(tmpPtr, [teal]'ALL0000000000000'[/teal]);
Items.AddObject([teal]'All'[/teal], tobject(tmpPtr));
count:=[purple]0[/purple];
[b]if[/b] GraphData.dbfData.Seek(tableName) [b]then[/b] [b]begin[/b]
[b]while[/b] [b]not[/b] GraphData.DBFData.Eof [b]do[/b] [b]begin[/b]
[b]if[/b] GraphData.DBFData.fieldAsString([teal]'TBL_NAME'[/teal])<>TRIM(tableName) [b]then[/b]
break;
tableId:= GraphData.DBFData.fieldAsString([teal]'TBL_ID'[/teal]);
Tabledesc:=GraphData.DBFData.fieldAsString([teal]'DESC'[/teal]);
getmem(tmpPtr, [purple]17[/purple]);
strcopy(tmpPtr, pchar(tableId));
Items.AddObject(Tabledesc, tobject(tmpPtr));
inc(count);
GraphData.dbfData.Skip([purple]1[/purple]);
[b]end[/b];
[b]end[/b];
len:=count+[purple]1[/purple];
freemem(tmpptr, len);
GraphData.DBFData.Close;
screen.Cursor:=crDefault;
Retrieve code when they select an item from the list...
Code:
[b]if[/b] [b]not[/b] mDataLoaded [b]then[/b]
[b]begin[/b]
InitializeYearData;
tmpPtr := pchar(cbxType.items.objects[cbxType.itemIndex]);
[b]if[/b] tmpPtr <> [b]nil[/b] [b]then[/b]
accountId := strPas(tmpPtr);
grGetAttendanceData(accountId, intToStr(edYear1.value),
mClassType, mYear1, mY1Count);
grGetAttendanceData(accountId, intToStr(edYear2.value),
mClassType, mYear2, mY2Count);
mDataLoaded := true;
[b]end[/b];
[navy] for automatic syntax highlighting see faq102-6487
[/navy]