Board index » cppbuilder » odd behavior using frames

odd behavior using frames


2004-06-22 08:11:27 AM
cppbuilder69
Hi,
I have a form which contains a few frames. One these frames I have buttons
doing different things.
Clicking one of these buttons when the main form is open should create a
"wrapper" function for the underlying frames function. Now it has happened
several times that I get an empty function like this
void __fastcall TStatForm::TgetParametersFrame1Button2Click(TObject *Sender)
{
}
which is not right of course.. anyone knows why this happens?
also sometimes the code in such a wrapperfunction is not executed at all.
For example I have this function
void __fastcall TStatForm::TgetParametersFrame1Button2Click(TObject *Sender)
{
TCursor crsCount = Screen->Cursor;
Screen->Cursor = crHourGlass;
TgetParametersFrame1->searchForParaExecute(Sender); //Should be called
in a thread
Screen->Cursor = crsCount;
//Add search to other tab
TRocCurveFrame1->PopFrame1->AddBigSearch(TgetParametersFrame1->GetSearch());
TRocCurveFrame1->PopFrame2->AddBigSearch(TgetParametersFrame1->GetSearch());
TBigSearches1->AddBigSearch(TgetParametersFrame1->GetSearch());
TBigSearches1->UpdateFrame();
}
The last two lines updates another frame with the result from some other
frame. When the code is not executed my frames are not updated. However, I
have found that when I set a breakpoint inside this function, and recompile,
the code is executed again! I can then remove the breakpoint and the code
works ok for some time. This is puzzling.. anyone having a clue on what is
going on?
-totte
 
 

Re:odd behavior using frames

"Totte Karlsson" < XXXX@XXXXX.COM >wrote in message
Quote
Hi,
I have a form which contains a few frames. One these frames I have buttons
doing different things.
Clicking one of these buttons when the main form is open should create a
"wrapper" function for the underlying frames function. Now it has happened
several times that I get an empty function like this

void __fastcall TStatForm::TgetParametersFrame1Button2Click(TObject
*Sender)
{

}

which is not right of course.. anyone knows why this happens?
That is what I would expect to happen. Are you saying that sometimes it does
not?
If you want the frame altered, you need to edit the frame seperately, if you
alter the frame in a form, you are altering how it is used in that instance,
so giving a button an event handler will only happen for that form. If the
button has a click event already it will be replaced for example.
Quote
also sometimes the code in such a wrapperfunction is not executed at all.
For example I have this function

void __fastcall TStatForm::TgetParametersFrame1Button2Click(TObject
*Sender)
{
<snip code>
}
Quote

The last two lines updates another frame with the result from some other
frame. When the code is not executed my frames are not updated. However, I
have found that when I set a breakpoint inside this function, and
recompile,
the code is executed again! I can then remove the breakpoint and the code
works ok for some time. This is puzzling.. anyone having a clue on what is
going on?
Sounds like some kind of bug, but not one I've seen (BCB5).
HTH.
Simon.
 

Re:odd behavior using frames

thanks for your reply,
Quote
>Clicking one of these buttons when the main form is open should create a
>"wrapper" function for the underlying frames function. Now it has
happened
>several times that I get an empty function like this
>
>void __fastcall TStatForm::TgetParametersFrame1Button2Click(TObject
*Sender)
>{
>
>}
>
>which is not right of course.. anyone knows why this happens?

That is what I would expect to happen. Are you saying that sometimes it
does
not?

It's not what should happen!
What should happen is that the underlying function should be automatically
wrapped,
e.g. in the frame, I have button4 associated with an action, when clicking
the button in the "standalone" frame i get to this code (the actions execute
method)
void __fastcall TgetParametersFrame::ClearSearchesExecute(TObject *Sender)
{
aSearch.Clear();
paraMemo->Clear();
}
when clicking the same button on the frame, when it is places on the form,
the following code is generated :
void __fastcall TStatForm::TgetParametersFrame1Button4Click(TObject *Sender)
{
TgetParametersFrame1->ClearSearchesExecute(Sender);
}
so the underlying action is executed..
.. what I tried to say was that sometimes the generated code looks like this
void __fastcall TStatForm::TgetParametersFrame1Button4Click(TObject *Sender)
{
}
which is not right.. I have not seen it many times, but in this particular
project it happens all the time :(
Something is messed up somewhere and I don't know what it is?
-totte
 

{smallsort}

Re:odd behavior using frames

"Totte Karlsson" < XXXX@XXXXX.COM >wrote in message
Quote
It's not what should happen!
I tried it and it does what you said (oops).
Quote
which is not right.. I have not seen it many times, but in this particular
project it happens all the time :(
Something is messed up somewhere and I don't know what it is?

-totte
The first place I would look is the .dfm and .bpr files for anything odd.
Perhaps something is set that overrides the normal behavior.
Simon.