home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-10-02 | 1.7 KB | 70 lines | [TEXT/PJMM] |
- program IconTest;
-
- const
- dialogID = 128;
- firstIconButton = 2;
- lastIconButton = 4;
- disableCheckbox = 5;
- hideCheckbox = 6;
-
- var
- theDialog: DialogPtr;
- itemHit: Integer;
- i: Integer;
- evt: EventRecord;
-
- function GetControlHandle (item: Integer): ControlHandle;
- var
- kind: Integer;
- h: Handle;
- r: Rect;
- begin
- GetDItem(theDialog, item, kind, h, r);
- if BAND(kind, $FC) = ctrlItem then
- GetControlHandle := ControlHandle(h)
- else
- GetControlHandle := nil;
- end;
-
- begin
- theDialog := GetNewDialog(dialogID, nil, POINTER(-1));
- SetPort(theDialog);
- TextFont(geneva); {Try different fonts and sizes to see how useWFont variant works…}
- TextSize(9);
- ShowWindow(theDialog);
- for i := 1 to 3 do {Have to do this to synchronize TE items to the window font!}
- if EventAvail(everyEvent, evt) then
- ;
- with DialogPeek(theDialog)^.textH^^ do
- begin
- txFont := theDialog^.txFont;
- txSize := theDialog^.txSize;
- end;
- InitCursor;
- repeat
- ModalDialog(nil, itemHit);
-
- if ItemHit = firstIconButton then
- SysBeep(5);
-
- if ItemHit = disableCheckbox then
- begin
- SetCtlValue(GetControlHandle(disableCheckbox), 1 - GetCtlValue(GetControlHandle(disableCheckbox)));
- if GetCtlValue(GetControlHandle(disableCheckbox)) = 0 then
- HiliteControl(GetControlHandle(lastIconButton), 0)
- else
- HiliteControl(GetControlHandle(lastIconButton), 255);
- end;
-
- if itemHit = hideCheckbox then
- begin
- SetCtlValue(GetControlHandle(hideCheckbox), 1 - GetCtlValue(GetControlHandle(hideCheckbox)));
- if GetCtlValue(GetControlHandle(hideCheckbox)) = 0 then
- ShowControl(GetControlHandle(lastIconButton))
- else
- HideControl(GetControlHandle(lastIconButton));
- end;
-
- until ItemHit = OK;
- DisposDialog(theDialog);
- end.