[futurebasic] Re: [FB] read only HITextView

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2009 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Mon, 26 Oct 2009 11:21:01 +1300
Brian Heibert wrote:

> I am using a HITextView
>
> is it possible to make it read only in code when a menuitem is clicked
> and when another menuitem is clicked make it editable again?

You could call fn SetTextViewEditability( txtView, _false ) to make it  
noneditable, and fn SetTextViewEditability( txtView, _zTrue ) to make  
it editable again.


'----------
include "Util_CE.incl"

local mode
local fn TextViewNoEdit( nextHandler as EventHandlerCallRef, inEvent  
as EventRef, userData as pointer )
'~'1
end fn = _userCanceledErr

local mode
local fn SetTextViewEditability( txtView as HIViewRef, editable as  
Boolean )
'~'1
begin globals
dim as EventHandlerRef  sNoEditHandler
end globals
long if ( editable )
long if ( sNoEditHandler )
fn RemoveEventHandler( sNoEditHandler )
sNoEditHandler = 0
end if
xelse
long if ( sNoEditHandler == 0 )
fn CEAddEvent( _kEventClassTextField, _kEventTextShouldChangeInRange )
fn CEInstallControlEventHandler( txtView, @fn TextViewNoEdit, 0,  
@sNoEditHandler )
end if
end if
end fn
'----------

Robert P.