home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
ib
/
setups
/
intrabld
/
data.z
/
TMD.CC
< prev
next >
Wrap
Text File
|
1996-12-11
|
3KB
|
86 lines
/****************************************************************************\
* *
* TMD.cc -- IntraBuilder Custom Controls used by the TMD project *
* *
* *
* Updated 9/18/96 by IntraBuilder Publications Group *
* $Revision: 1.0 $ *
* *
* Copyright (c) 1996, Borland International, Inc. All rights reserved. *
* *
\****************************************************************************/
class messagesQuery extends Query custom {
with (this) {
left = 76;
top = 0;
sql = 'SELECT * FROM "messages.db"';
active = true;
}
with (this.rowset) {
fields["From"].beforeGetValue = class::from_beforeGetValue
fields["Section"].canChange = class::section_canChange
fields["Section"].beforeGetValue = class::section_beforeGetValue
indexName = "Thread";
}
function onOpen()
{
with ( this.qUsers = new Query() ) {
sql = "select * from USERS.DB";
active = true;
}
with ( this.qSections = new Query() ) {
sql = "select * from SECTIONS.DB";
active = true;
}
}
function from_beforeGetValue()
{
if ( this.parent.parent.endOfSet ) {
// When navigating to end-of-set
return null;
}
else if ( this.value == null ) {
// For beginAppend()
return "";
}
else {
// Normal lookup, with value in case lookup fails
var r = this.parent.parent.parent.qUsers.rowset;
return r.applyLocate( '"User ID" = ' + parseInt( this.value ) ) ?
r.fields[ "User name" ].value : "Unregistered";
}
}
function section_beforeGetValue()
{
if ( this.parent.parent.endOfSet ) {
// When navigating to end-of-set
return null;
}
else if ( this.value == null ) {
// For beginAppend()
return "";
}
else {
// Normal lookup, with value in case lookup fails
var r = this.parent.parent.parent.qSections.rowset;
return r.applyLocate( '"Section #" = ' + parseInt( this.value ) ) ?
r.fields[ "Name" ].value : "Closed section";
}
}
function section_canChange( newValue )
{
var r = this.parent.parent.parent.qSections.rowset;
if ( r.applyLocate( '"Name" = \'' + newValue +'\'' ) ) {
this.value = r.fields[ "Section #" ].value;
}
return false;
}
}