Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I use ActiveControl w/ TFrames? 1

Status
Not open for further replies.

Elkari

Programmer
May 1, 2001
144
US
I have a main form that controls the common elements of entering and editing data for different DBs. The frames are then unique to the data being entered. With the OnExit event for each data element, I check to make sure data was entered correctly and if is isn't, I want the program to stay on that field. However, TFrames do not have the ActiveControl property. I have tried this line of code in OnExit, but I get an error with it.

procedure Frame1.eDataOnExit( Sender : TObject );
begin
if ( eData.Text = '' ) then
Form1.ActiveControl := eData;
end;
 
Not sure I'm getting you meaning right, what about using SetFocus?

if SomeControl.Text = ''
then SomeControl.SetFocus;


BTW: Please, say what error are you getting. It is easy for us to help you if we have enough info.

buho (A).

 
Sorry I forgot to include the error. It's -

[blue]Project MediaCatalog.exe raised exception classEAccessViolation with message 'Access violation at address 0044D376 in module 'MediaCatalog.exe'. Read of address 00000208'. Process stopped. Use Step or Run to continue.[/blue]

Anyhow, your suggestion worked, thanks a lot. [thumbsup2]

I was so used to use ActiveControl in forms to control which element had focus, I totally forgot about the SetFocus property of each element.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top