Category : Windows 3.X Files
Archive   : ACTTIMS.ZIP
Filename : INSERTDL.CLS
inherit(TimsDialog, #InsertDlg, #(buttonStatus), 2, nil)!!
now(class(InsertDlg))!!
now(InsertDlg)!!
Def save(self | aRec, iRec, kRec, xRec, tRec, count, data)
{
aRec := new(AuthorObj, database);
iRec := new(InfoObj, database);
kRec := new(KeyWordObj, database);
xRec := new(IntersectObj, iRec, database);
tRec := new(TextObj, database);
setName(aRec, getItemText(self, IDI_AUTHOR));
makeNew(aRec);
setIdCode(iRec, getItemText(self, IDI_IDCODE));
setInfoTitle(iRec, getItemText(self, IDI_TITLE));
setPublisher(iRec, getItemText(self, IDI_PUBLISHER));
setPubDate(iRec, getItemText(self, IDI_PUBLISHED));
if buttonStatus = IDI_ARTICLE then
setInfoType(iRec, 2);
else
if buttonStatus = IDI_BOOK then
setInfoType(iRec, 0);
else
if buttonStatus = IDI_MAGAZINE then
setInfoType(iRec, 1);
endif;
endif;
endif;
if makeNew(iRec, aRec) = S_DUPLICATE then
^end(self, -1);
endif;
count := getLBSize(self, IDI_LIST) - 1;
data := new(String, 32);
loop
while count >= 0 begin
sendDlgItemMessage(self, IDI_LIST, LB_GETTEXT, count, data);
setWord(kRec, data);
makeNew(kRec);
setIntType(xRec, getInfoType(iRec));
makeNew(xRec, iRec, kRec);
count := count - 1;
endLoop;
data := getItemText(self, IDI_ABSTRACT);
if limit(data) > 0 then
loop
while limit(data) > 80 begin
count := findBreak(data, 80);
setLine(tRec, subString(data, 0, count));
makeNew(tRec, iRec);
data := leftJustify(delete(data, 0, count));
endLoop;
if limit(data) > 0 then
setLine(tRec, data);
makeNew(tRec, iRec);
endif;
endif;
^end(self, 0);
}!!
Def delete(self)
{
sendDlgItemMessage(self, IDI_LIST, LB_DELETESTRING, getLBSel(self, IDI_LIST), 0L);
sendDlgItemMessage(self, IDI_LIST, LB_SETCURSEL, -1, 0L);
disableItem(self, IDI_CHANGE);
disableItem(self, IDI_DELETE);
}
!!
Def change(self | tmpStr)
{
tmpStr := getLBText(self, IDI_LIST);
sendDlgItemMessage(self, IDI_LIST, LB_DELETESTRING, getLBSel(self, IDI_LIST), 0L);
sendDlgItemMessage(self, IDI_LIST, LB_SETCURSEL, -1, 0L);
setItemText(self, IDI_KEYWORD, tmpStr);
sendDlgItemMessage(self, IDI_KEYWORD, EM_SETSEL, 0, 32767L);
setItemFocus(self, IDI_KEYWORD);
enableItem(self, IDI_ADD);
disableItem(self, IDI_CHANGE);
disableItem(self, IDI_DELETE);
}
!!
Def add(self | tmpStr, count, LBStr)
{
tmpStr := removeNulls(getItemText(self, IDI_KEYWORD));
count := getLBSize(self, IDI_LIST) - 1;
LBStr := new(String, 30);
loop
while count >= 0 begin
sendDlgItemMessage(self, IDI_LIST, LB_GETTEXT, count, LBStr);
if removeNulls(LBStr) = tmpStr then
setItemText(self, IDI_KEYWORD, "");
setItemFocus(self, IDI_KEYWORD);
disableItem(self, IDI_ADD);
^1;
endif;
count := count - 1;
endLoop;
addLBText(self, IDI_LIST, tmpStr);
setItemText(self, IDI_KEYWORD, "");
setItemFocus(self, IDI_KEYWORD);
disableItem(self, IDI_ADD);
}
!!
Def keyWord(self)
{
if size(removeNulls(getItemText(self, IDI_KEYWORD))) > 0 then
enableItem(self, IDI_ADD);
else
disableItem(self, IDI_ADD);
endif;
}
!!
Def listPushed(self)
{
if size(getLBText(self, IDI_LIST)) > 0 then
enableItem(self, IDI_CHANGE);
enableItem(self, IDI_DELETE);
else
disableItem(self, IDI_CHANGE);
disableItem(self, IDI_DELETE);
endif;
}
!!
Def pushButton(self, which)
{
if buttonStatus <> nil then
toggle(self, buttonStatus);
endif;
toggle(self, which);
buttonStatus := which;
textChange(self);
}
!!
Def textChange(self)
{
if (size(getItemText(self, IDI_AUTHOR)) > 0) and
(size(getItemText(self, IDI_TITLE)) > 0) and
(size(getItemText(self, IDI_PUBLISHER)) > 0) and
(size(getItemText(self, IDI_PUBLISHED)) > 0) and
(size(getItemText(self, IDI_IDCODE)) > 0) and
(buttonStatus <> nil) then
enableItem(self, IDI_OK);
else
disableItem(self, IDI_OK);
endif;
}
!!
/* By returning a 1 from the INITDIALOG message, we
are telling MS-Windows to set the input focus to
first tabstop item. (See MS-Windows Reference). */
Def initDialog(self, wP, lP)
{
database := getDB(parent);
disableItem(self, IDI_OK);
disableItem(self, IDI_ADD);
disableItem(self, IDI_CHANGE);
disableItem(self, IDI_DELETE);
buttonStatus := nil;
^1;
}!!
Def command(self, wp, lp)
{ select
case wp == IDI_CANCEL
is ^end(self, IDI_CANCEL);
endCase
case wp == IDI_OK
is ^save(self);
endCase
case wp == IDI_ADD
is ^add(self);
endCase
case wp == IDI_CHANGE
is ^change(self);
endCase
case wp == IDI_DELETE
is ^delete(self);
endCase
case wp == IDI_ARTICLE
is ^pushButton(self, IDI_ARTICLE);
endCase
case wp == IDI_BOOK
is ^pushButton(self, IDI_BOOK);
endCase
case wp == IDI_MAGAZINE
is ^pushButton(self, IDI_MAGAZINE);
endCase
case wp == IDI_AUTHOR and high(lp) = EN_CHANGE
is ^textChange(self);
endCase
case wp == IDI_TITLE and high(lp) = EN_CHANGE
is ^textChange(self);
endCase
case wp == IDI_PUBLISHER and high(lp) = EN_CHANGE
is ^textChange(self);
endCase
case wp == IDI_PUBLISHED and high(lp) = EN_CHANGE
is ^textChange(self);
endCase
case wp == IDI_IDCODE and high(lp) = EN_CHANGE
is ^textChange(self);
endCase
case wp == IDI_KEYWORD and high(lp) = EN_CHANGE
is ^keyWord(self);
endCase
case wp == IDI_LIST and high(lp) = LBN_DBLCLK
is ^change(self);
endCase
case wp == IDI_LIST
is ^listPushed(self);
endCase
endSelect;
^0;
}!!
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/