ok I have solved the problem... strange one tho
 
As it turns out, I was using speed buttons (because i like the way they can be the same colour as the form and raise on focus etc etc), i replaced btnSaveChanges with a normal button and.. no more errors.  Odd how that could cause table edit state errors. 
 
thanks for all your input anyway guys 
 
Tracey
 
----- Original Message -----
Sent: Tuesday, October 15, 2002 10:44 AM
Subject: Re: [DUG]: Cannot focus a disabled or invisible window

If I am correct in what I was saying about the button setting focus to itself after executing the code - It will keep trying to set focus to itself when it has finished executing its code (regardless of what you do in the code that it executes) i.e. once it has finished setting focus to this that and the other control, it will then try and focus to itself...
 
 
 
Regards
Paul McKenzie
Analyst Programmer
SMSS Ltd.
----- Original Message -----
Sent: Tuesday, October 15, 2002 10:37 AM
Subject: Re: [DUG]: Cannot focus a disabled or invisible window

well, i tried to set form.activecontrol to another button, i still get these errors
 
----- Original Message -----
Sent: Tuesday, October 15, 2002 9:45 AM
Subject: Re: [DUG]: Cannot focus a disabled or invisible window

This is a guess (I haven't time to test it out) - the button which is currently active (ie running the code) is attempting to focus itself following the code execution.
Even though you have set focus elsewhere, the button is trying to set focus following the execution of the code...
 
 
Regards
Paul McKenzie
Analyst Programmer
SMSS Ltd.
----- Original Message -----
Sent: Tuesday, October 15, 2002 9:39 AM
Subject: [DUG]: Cannot focus a disabled or invisible window

Hi there...
 
I have a form with a DBGrid showing values from one table (tblCompany)
I am currently trying to provide new record/edit functionality with code, rather than use one of those ugly DBNavigators. 
 
My problem is with the edit.  I have an edit button displayed always, when the user selects edit, an invisible edit box is made visible, along with a "save changes" button.
(someone told me once not to allow users to edit/add within a grid...)
my problem is that when i click save changes i receive two error messages (the original focus message (subject line) plus a "dataset not in edit mode" one)
 
i suspect the focus problem is because i am making the edit box invisible while focus is still set to it, however i tried setting focus to another edit box and the error did not change.
 
heres the few lines of code i have
    tblCompany.Edit;
    tblCompany.FieldByName('name').Value := txtNewValue.Text;
    tblCompany.Post;
    txtNewValue.Text := '';
    txtHoneyPot.SetFocus;
    btnSaveEdit.Visible := false;
    txtNewValue.Visible := false;
please lend me the benifit of your decades of experience and knowledge here
 
Tracey
Software Developer / Web Master
Logis
[EMAIL PROTECTED]
(025) 213-1065

Attachment: thumbsdown.gif
Description: GIF image

Reply via email to