[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-Toolbox] Disabling (not Hiding) items in dialogboxes?



Hello!

Perhaps I can add something to the discussion?..:

1 1/2 years ago, before I knew of Perl, I wrote some things in Modula-2,
and for handling dialogs I wrote two Modules ('Dialoger001' and
'Dialoger002', the latter with more possibilities). Greying out an item was
really easy using the Toolbox routines 'HiliteControl' (Control Manager):

(...)

VAR itemType: INTEGER;
	item: Handle;
	box: Rect;

PROCEDURE Disable( itemNo: INTEGER);
BEGIN
	TbxGetDItem (AktDlg^.meinDialog, itemNo, itemType, item, box);	(*
get item handle *)
  	TbxHiliteControl (ControlHandle(item), 255);
END Disable;

PROCEDURE Enable( itemNo: INTEGER);
BEGIN
	TbxGetDItem (AktDlg^.meinDialog, itemNo, itemType, item, box);	(*
get item handle *)
  	TbxHiliteControl (ControlHandle(item), 0);
END Enable;

- 'AktDlg' is a global variable holding a pointer to the actual dialog
(yes, I implemented it with globals, so I didn't need to refer to a
specific dialog for every procedure - Modula2 isn't object oriented..);
- 'AktDlg^.meinDialog' is a DialogPtr (the pointer to the dialog);
- 'ControlHandle' is a data type; 'ControlHandle(item)' means a type
conversion from an universal handle to a control handle.
- The toolbox calls have 'Tbx' in front of them because I decided to do so
(I wrote all interface modules to the toolbox myself..).

(Note that I did not use the newer colour routines. In my implementation a
greyed item was displayed with a pattern (like on the old black&white
macs). But probably the above routines are the same with color dialogs.)

If someone wants to take a look on the whole 'Dialoger' modules, I'll be
glad to send them (most comments are in german :-( ). I used the free (and
spartaneous) Modula2 environment from ETH Zurich (N. Wirth et al.), MacMETH.

Christian Jaeger


___________________________________________________________________
Christian Jaeger     Burgstr. 26      8037 Zürich     01/273 65 46
EAWAG   Chemie/CHE   8600 Dübendorf   PAV-12/LA-E53    01/823 5212
Rektorat ETH Zentrum  HG F 69.2  01/63 22062  www.rektorat.ethz.ch



==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-toolbox-request@macperl.org