home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
ib
/
setups
/
intrabld
/
data.z
/
EXPERT.CC
< prev
next >
Wrap
Text File
|
1996-12-11
|
8KB
|
208 lines
/****************************************************************************\
* *
* Expert.cc -- IntraBuilder Custom Controls. Contains custom buttons and *
* images like those created by the Form Expert. *
* *
* Updated 10/26/96 by IntraBuilder Samples Group *
* $Revision: 1.1 $ *
* *
* Copyright (c) 1996, Borland International, Inc. All rights reserved. *
* *
\****************************************************************************/
class ExpertImage(FormObj,ImageFile) extends Image(FormObj) {
this.alignment = 4; //true size;
this.image = ImageFile;
function onDesignLoad(bNew)
{
if (bNew && this.image.substring(0,11) != 'ExpertImage') {
with (new File())
if (!exists(this.image))
copy(_sys.env.home() + "designer\\form\\" + this.image, this.image);
this.dataSource = "filename " + this.image;
}
this.onDesignLoad = null;
}
}
class NavigateHorizontalImage(FormObj) extends ExpertImage(FormObj,"expinavh.gif") custom {
with (this) {
onImageServerClick = {|nLeft, nTop|;if (nLeft >= 26*0 && nLeft < 26*1){form.rowset.first()}else if (nLeft >= 26*1 && nLeft < 26*2){if (!form.rowset.next(-1)) form.rowset.next();}else if (nLeft >= 26*2 && nLeft < 26*3){if (!form.rowset.next()) form.rowset.next(-1);}else{form.rowset.last()}};
}
}
class NavigateVerticalImage(FormObj) extends ExpertImage(FormObj,"expinavv.gif") custom {
with (this) {
onImageServerClick = {|nLeft, nTop|;if (nTop >= 23*0 && nTop < 23*1){form.rowset.first()}else if (nTop >= 23*1 && nTop < 23*2){if (!form.rowset.next(-1)) form.rowset.next();}else if (nTop >= 23*2 && nTop < 23*3){if (!form.rowset.next()) form.rowset.next(-1);}else{form.rowset.last()}};
}
}
class FirstImage(FormObj) extends ExpertImage(FormObj,"navfirst.gif") custom {
with (this) {
onImageServerClick = {;form.rowset.first()};
}
}
class LastImage(FormObj) extends ExpertImage(FormObj,"navlast.gif") custom {
with (this) {
onImageServerClick = {;form.rowset.last()};
}
}
class NextImage(FormObj) extends ExpertImage(FormObj,"navnext.gif") custom {
with (this) {
onImageServerClick = {;if (!form.rowset.next()) form.rowset.next(-1);};
}
}
class PreviousImage(FormObj) extends ExpertImage(FormObj,"navprev.gif") custom {
with (this) {
onImageServerClick = {;if (!form.rowset.next(-1)) form.rowset.next();};
}
}
class UpdateHorizontalImage(FormObj) extends ExpertImage(FormObj,"expirowh.gif") custom {
with (this) {
onImageServerClick = {|nLeft, nTop|;if (nLeft >= 26*0 && nLeft < 26*1){form.rowset.beginAppend()}else if (nLeft >= 26*1 && nLeft < 26*2){form.rowset.delete()}else if (nLeft >= 26*2 && nLeft < 26*3){form.rowset.save()}else if (nLeft >= 26*3 && nLeft < 26*4){form.rowset.abandon()}else if (nLeft >= 26*4 && nLeft < 26*5){form.rowset.beginEdit()}else if (nLeft >= 26*5 && nLeft < 26*6){with(this) {if (form.rowset.state==5) {text="New Query";form.rowset.applyLocate();} else {text="Run Query";form.rowset.beginLocate();}}}else{with(this) {if (form.rowset.state==4) {text="New Filter";form.rowset.applyFilter();} else {text="Run Filter";form.rowset.beginFilter();}}}};
}
}
class UpdateVerticalImage(FormObj) extends ExpertImage(FormObj,"expirowv.gif") custom {
with (this) {
onImageServerClick = {|nLeft, nTop|;if (nTop >= 23*0 && nTop < 23*1){form.rowset.beginAppend()}else if (nTop >= 23*1 && nTop < 23*2){form.rowset.delete()}else if (nTop >= 23*2 && nTop < 23*3){form.rowset.save()}else if (nTop >= 23*3 && nTop < 23*4){form.rowset.abandon()}else if (nTop >= 23*4 && nTop < 23*5){form.rowset.beginEdit()}else if (nTop >= 23*5 && nTop < 23*6){with(this) {if (form.rowset.state==5) {text="New Query";form.rowset.applyLocate();} else {text="Run Query";form.rowset.beginLocate();}}}else{with(this) {if (form.rowset.state==4) {text="New Filter";form.rowset.applyFilter();} else {text="Run Filter";form.rowset.beginFilter();}}}};
}
}
class AddImage(FormObj) extends ExpertImage(FormObj,"updadd.gif") custom {
with (this) {
onImageServerClick = {;form.rowset.beginAppend()};
}
}
class DeleteImage(FormObj) extends ExpertImage(FormObj,"upddel.gif") custom {
with (this) {
onImageServerClick = {;if (!form.rowset.endOfSet) {form.rowset.delete(); if (form.rowset.endOfSet) {form.rowset.last();}}};
}
}
class EditImage(FormObj) extends ExpertImage(FormObj,"updedit.gif") custom {
with (this) {
onImageServerClick = {;form.rowset.beginEdit()};
}
}
class SaveImage(FormObj) extends ExpertImage(FormObj,"updsave.gif") custom {
with (this) {
onImageServerClick = {;form.rowset.save()};
}
}
class AbandonImage(FormObj) extends ExpertImage(FormObj,"updaban.gif") custom {
with (this) {
onImageServerClick = {;form.rowset.abandon()};
}
}
class SearchImage(FormObj) extends ExpertImage(FormObj,"srchqbf.gif") custom {
with (this) {
onImageServerClick = {;with(this) {if (form.rowset.state==5) {text="New Query";form.rowset.applyLocate();} else {text="Run Query";form.rowset.beginLocate();}}};
}
}
class FilterImage(FormObj) extends ExpertImage(FormObj,"fltrfbf.gif") custom {
with (this) {
onImageServerClick = {;with(this) {if (form.rowset.state==4) {text="New Filter";form.rowset.applyFilter();} else {text="Run Filter";form.rowset.beginFilter();}}};
}
}
class FirstButton(FormObj) extends Button(FormObj) custom {
with (this) {
width = 12;
text = "First";
onServerClick = {;form.rowset.first()};
}
}
class LastButton(FormObj) extends Button(FormObj) custom {
with (this) {
width = 12;
text = "Last";
onServerClick = {;form.rowset.last()};
}
}
class NextButton(FormObj) extends Button(FormObj) custom {
with (this) {
width = 12;
text = "Next";
onServerClick = {;if (!form.rowset.next()) form.rowset.next(-1);};
}
}
class PreviousButton(FormObj) extends Button(FormObj) custom {
with (this) {
width = 12;
text = "Previous";
onServerClick = {;if (!form.rowset.next(-1)) form.rowset.next();};
}
}
class AddButton(FormObj) extends Button(FormObj) custom {
with (this) {
width = 12;
text = "Add";
onServerClick = {;form.rowset.beginAppend()};
}
}
class DeleteButton(FormObj) extends Button(FormObj) custom {
with (this) {
width = 12;
text = "Delete";
onServerClick = {;if (!form.rowset.endOfSet) {form.rowset.delete(); if (form.rowset.endOfSet) {form.rowset.last();}}};
}
}
class EditButton(FormObj) extends Button(FormObj) custom {
with (this) {
width = 12;
text = "Edit";
onServerClick = {;form.rowset.beginEdit()};
}
}
class SaveButton(FormObj) extends Button(FormObj) custom {
with (this) {
width = 12;
text = "Save";
onServerClick = {;form.rowset.save()};
}
}
class AbandonButton(FormObj) extends Button(FormObj) custom {
with (this) {
width = 12;
text = "Abandon";
onServerClick = {;form.rowset.abandon()};
}
}
class SearchButton(FormObj) extends Button(FormObj) custom {
with (this) {
width = 12;
text = "New Query";
onServerClick = {;with(this) {if (form.rowset.state==5) {text="New Query";form.rowset.applyLocate();} else {text="Run Query";form.rowset.beginLocate();}}};
}
}
class FilterButton(FormObj) extends Button(FormObj) custom {
with (this) {
width = 12;
text = "New Filter";
onServerClick = {;with(this) {if (form.rowset.state==4) {text="New Filter";form.rowset.applyFilter();} else {text="Run Filter";form.rowset.beginFilter();}}};
}
}