home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
ib
/
setups
/
intrabld
/
data.z
/
CONTROLS.CC
< prev
next >
Wrap
Text File
|
1996-12-11
|
7KB
|
182 lines
/****************************************************************************\
* *
* Controls.cc -- IntraBuilder Custom Controls *
* *
* There are several types of controls in this file: *
* *
* Select Controls *
* *
* FieldSelect() - options come from table field *
* FileSelect() - options come from table field *
* *
* ListBox Controls *
* *
* FieldListBox() - options come from table field *
* FileListBox() - options come from table field *
* *
* Button Controls *
* *
* ClientBackButton() - Move back a page on the client *
* ServerBackButton() - Move back a form on the server *
* *
* HTML Controls *
* *
* CenterHTML() - Display HTML text centered *
* GeneratedHTML() - Display generated by IntraBuilder text *
* *
* Updated 10/04/96 by IntraBuilder Samples Group *
* $Revision: 1.8 $ *
* *
* Copyright (c) 1996, Borland International, Inc. All rights reserved. *
* *
\****************************************************************************/
class FieldListBox(FormObj) extends ListBox(FormObj) custom {
with (this) {
options = "array {'table','field'}";
}
function onServerLoad() {
this.source = eval(this.options.substring(6,this.options.length));
this.fillOptions();
}
function fillOptions(){
this.array = new Array();
var q = new Query();
q.database = this.form.rowset.parent.database;
q.requestLive = false;
if (this.source[0].indexOf(" ") > 0 || this.source[1].indexOf(" ") > 0)
q.sql = 'SELECT DISTINCT s."' + this.source[1] + '" from "' + this.source[0] + '" s';
else
q.sql = 'SELECT DISTINCT ' + this.source[1] + ' from ' + this.source[0];
q.active = true;
while (!q.rowset.endOfSet) {
this.array.add(q.rowset.fields[this.source[1]].value);
q.rowset.next();
}
this.options = "array this.array";
}
}
class FieldSelect(FormObj) extends Select(FormObj) custom {
with (this) {
options = "array {'table','field'}";
}
function onServerLoad() {
this.source = eval(this.options.substring(6,this.options.length));
this.fillOptions();
}
function fillOptions(){
this.array = new Array();
var q = new Query();
q.database = this.form.rowset.parent.database;
q.requestLive = false;
if (this.source[0].indexOf(" ") > 0 || this.source[1].indexOf(" ") > 0)
q.sql = 'SELECT DISTINCT s."' + this.source[1] + '" from "' + this.source[0] + '" s';
else
q.sql = 'SELECT DISTINCT ' + this.source[1] + ' from ' + this.source[0];
q.active = true;
while (!q.rowset.endOfSet) {
this.array.add(q.rowset.fields[this.source[1]].value);
q.rowset.next();
}
this.options = "array this.array";
if (((this.dataLink+"~") == "~") && (this.array.length > 0))
this.value = this.array[0];
}
}
class FileListBox(FormObj) extends ListBox(FormObj) custom {
with (this) {
options = 'array {"*.*"}';
}
function onServerLoad()
{
this.source = eval(this.options.substring(6,this.options.length));
this.fillOptions();
}
function fillOptions()
{
var a = new Array();
this.files = new Array();
a.dirExt(this.source[0]);
for (var i = 0; i<(a.length/9); i++)
if (a[i,0].substring(0,9) != "Backup of")
this.files.add(a[i,0]);
this.files.sort();
this.options = "array this.files";
}
}
class FileSelect(FormObj) extends Select(FormObj) custom {
with (this) {
options = 'array {"*.*"}';
}
function onServerLoad()
{
this.source = eval(this.options.substring(6,this.options.length));
this.fillOptions();
}
function fillOptions()
{
var a = new Array();
this.files = new Array();
a.dirExt(this.source[0]);
for (var i = 0; i<(a.length/9); i++)
if (a[i,0].substring(0,9) != "Backup of")
this.files.add(a[i,0]);
this.files.sort();
this.options = "array this.files";
if (((this.dataLink+"~") == "~") && (this.files.length > 0))
this.value = this.files[0];
}
}
class GeneratedHTML(FormObj) extends HTML(FormObj) custom {
with (this) {
height = 1;
width = 70;
color = "black";
fontBold = false;
text = {||"<ADDRESS>Generated by IntraBuilder on " + new Date() + "</ADDRESS>"};
}
}
class CenterHTML(FormObj) extends HTML(FormObj) custom {
with (this) {
alignVertical = 1;
alignHorizontal = 1;
text = "CenterHTML";
}
}
class ServerBackButton(FormObj) extends Button(FormObj) custom {
with (this) {
width = 10.5;
text = "Back";
onServerClick = {;form.close()};
}
}
class ClientBackButton(FormObj) extends Button(FormObj) custom {
with (this) {
width = 10.5;
text = "Back";
onClick = class::ClientBackButton1_onClick;
}
function ClientBackButton1_onClick()
{
history.back();
}
}