 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Google Guest
|
Posted: Fri May 14, 2004 5:49 pm Post subject: CANNOT FOCUS A DISABLED OR INVISIBLE WINDOW |
|
|
I've read over a large portions of the message concerning the above.
I've been experiencing the problem. I was scanning one table
"DataModule2->IBTable_js", and if the a value wasn't in
"DataModule2->IBTable_r" (this was a lookup table), I would add it. I
would force "DataModule2->IBTable_r" to go to the first record before
the scan. This scanning process is done for several tables before
"DataModule2->IBTable_r". However, when I tried to scan
"DataModule2->IBTable_js" and add values to "DataModule2->IBTable_r",
when I issued the "DataModule2->IBTable_r->First();" command, I got
the error. "DataModule2->IBTable_r" was empty, because it was newly
created. I then added a record to "DataModule2->IBTable_r" and tried
it again, I never got the error.
Thought this might help! Here is the "stripped down code".
AnsiString as_r;
AnsiString as_r2;
int int_count = 0;
//-------------------------------------------------------------------
TLocateOptions Opts;
Opts.Clear();
Opts << loPartialKey;
Variant locvalues[1];
bool bool_found = false;
//-------------------------------------------------------------------
fld_memo->Lines->Add("(6) Update r Not Submitted");
DataModule2->IBTable_js->First();
while (!DataModule2->IBTable_js->Eof)
{
int_count++;
bool bool_found = false;
as_r = DataModule2->IBTable_r->FieldByName("r")->AsString;
as_r = as_r.UpperCase().Trim();
DataModule2->IBTable_r->First();
//-------------------------------------------------------------------
locvalues[0] = Variant(as_r);
bool_found = DataModule2->IBTable_r->Locate("r",
VarArrayOf(locvalues, 0), Opts);
if (bool_found == false)
{
DataModule2->IBTable_r->Append();
DataModule2->IBTable_r->FieldByName("r")->AsString =
as_r.Trim().UpperCase();
DataModule2->IBTable_r->Post();
}
DataModule2->IBTable_js->Next();
StatusBar1->SimpleText = IntToStr(int_count);
}
|
|
| Back to top |
|
 |
Google Guest
|
Posted: Sat May 15, 2004 5:29 pm Post subject: Re: CANNOT FOCUS A DISABLED OR INVISIBLE WINDOW |
|
|
I've also noticed during my testing, that if you try to append a blank
record to a table and the field is a primary key, you will also get
the same error. It seems that if you are accessing multiple tables,
depending on the circumstances, the error(s) can mislead you. In the
same code, if I forced the value to be added, and I got the violation
of the primary key error as expected. I then tried to add a "" to the
record and was able to duplicate the error every time!
Hope this help anyone!
Note, this and the post below was in BCB6 with Interbase/Firebird
tables.
[email]google_post (AT) mail2go (DOT) com[/email] (Google) wrote in message news:<d668e23c.0405140949.646050a9 (AT) posting (DOT) google.com>...
| Quote: | I've read over a large portions of the message concerning the above.
I've been experiencing the problem. I was scanning one table
"DataModule2->IBTable_js", and if the a value wasn't in
"DataModule2->IBTable_r" (this was a lookup table), I would add it. I
would force "DataModule2->IBTable_r" to go to the first record before
the scan. This scanning process is done for several tables before
"DataModule2->IBTable_r". However, when I tried to scan
"DataModule2->IBTable_js" and add values to "DataModule2->IBTable_r",
when I issued the "DataModule2->IBTable_r->First();" command, I got
the error. "DataModule2->IBTable_r" was empty, because it was newly
created. I then added a record to "DataModule2->IBTable_r" and tried
it again, I never got the error.
Thought this might help! Here is the "stripped down code".
AnsiString as_r;
AnsiString as_r2;
int int_count = 0;
//-------------------------------------------------------------------
TLocateOptions Opts;
Opts.Clear();
Opts << loPartialKey;
Variant locvalues[1];
bool bool_found = false;
//-------------------------------------------------------------------
fld_memo->Lines->Add("(6) Update r Not Submitted");
DataModule2->IBTable_js->First();
while (!DataModule2->IBTable_js->Eof)
{
int_count++;
bool bool_found = false;
as_r = DataModule2->IBTable_r->FieldByName("r")->AsString;
as_r = as_r.UpperCase().Trim();
DataModule2->IBTable_r->First();
//-------------------------------------------------------------------
locvalues[0] = Variant(as_r);
bool_found = DataModule2->IBTable_r->Locate("r",
VarArrayOf(locvalues, 0), Opts);
if (bool_found == false)
{
DataModule2->IBTable_r->Append();
DataModule2->IBTable_r->FieldByName("r")->AsString =
as_r.Trim().UpperCase();
DataModule2->IBTable_r->Post();
}
DataModule2->IBTable_js->Next();
StatusBar1->SimpleText = IntToStr(int_count);
}
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|