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

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



>At 10:43 AM -0500 5/20/99, Jefferson R. Lowrey wrote:
>>I remember something like 'EnableDialogItem'.  But, in a somewhat brief
>>glance at the toolbox references online, I can't find it.  I'm fairly sure
>>there's a flag that's settable in the resource, but that's not what we're
>>looking at here.
>>
>>The way I remember doing it (and it's been a while), I would set the enable
>>flag before drawing the dialog box, but I don't remember how it was done.
>>
>>Wait, I think I found it.  There's a constant, itemDisable, that gets added
>>to  the item type to disable it.
>
>Hmmm...when I try to do that, all I get is a BowelsOfTheMemoryMgr
>crash (to be specific, "Unmapped Memory Exception at 1B7A9EA8
>BowelsOfTheMemoryMgr+08568").  What I'm doing is:
>
>----------------------------<snip>----------------------------------
>$dlg = MacDialog->new(
>	Rect->new($hpos, $vpos, $hpos+512, $vpos+297),
>	'Configure your Dial-up connection',
>	1,# is visible?
>	movableDBoxProc(),# window style
>	0,# has go away box?
>
>	[ (kCheckBoxDialogItem() + kItemDisableBit()),
>		Rect->new(13, 13, 499, 33),
>		'Accessing an outside line'],
>
>----------------------------<snip>----------------------------------
>
>Is there something wrong with this code?
>

Unless Mac-Dialog->new shows the dialog (which it shouldn't, since there's
also a modal dialog?), I would do something more like

$dlg = MacDialog->new(
	Rect->new($hpos, $vpos, $hpos+512, $vpos+297),
	'Configure your Dial-up connection',
	1,# is visible?
	movableDBoxProc(),# window style
	0,# has go away box?

	[ (kCheckBoxDialogItem(),
		Rect->new(13, 13, 499, 33),
		'Accessing an outside line']
#and etc. the rest of the definition you've snipped out

($type, $handle, $box) = GetDialogItem($dlg, 0); # Or is that something else?

SetDialogItem($dlg,0,$type | kItemDisableBit(),$handle,$box);

and then show the dialog later.

At least, that's how I'd do it in C.

But,as Alan says, it might not grey it out.   And it might not work either.

-Jeff Lowrey



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