[futurebasic] Re: [FB] a few more FBtoC questions

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

From: Robert Purves <listrp@...>
Date: Wed, 8 Oct 2008 17:29:10 +1300
Mark Chappell wrote:

>>> 3.  Is there a way to get FBtoC to create non-static edit fields  
>>> without showing the *#$(&@ focus rectangle (which, when it  
>>> disappears, leaves a several pixel-wide overdrawn area, thus  
>>> precluding tight packing of edit fields, as adjacent fields  
>>> overwrite each other)
>>
>> I don't know of a way. The FB5 demo below shows how to get the  
>> visual appearance of no focus rect. But it does this by erasing the  
>> system-drawn halo before it becomes visible, and won't serve your  
>> purpose. I think you will have to adjust your layout to leave at  
>> least 7 pixels between editable text fields.
>
> OK, that's clear enough.  Thanks

I forgot about HITextView, which has no focus ring. Without extra code  
(a handler for kEventControlDraw), it doesn't even have a frame. Close- 
packing is therefore no problem.

Unfortunately, HITextView requires a compositing window  
(_kWindowCompositingAttribute) and this is likely to be prove  
difficult if you have a lot of old code that draws into the window.

Anyway, for completeness, here's a minimal HITextView demo.

Robert  P.

'--------------
include "Tlbx MacTextEditor.incl"

local fn BuildWindow
'~'1
dim as HIRect    hiRect
dim as HIViewRef txtView, contentView

appearance window 1,,, _kDocumentWindowClass,  
_kWindowStandardHandlerAttribute _kWindowCompositingAttribute
hiRect.origin.x = 100
hiRect.origin.y = 100
hiRect.size.width  = 200
hiRect.size.height = 16
fn HIViewFindByID( fn HIViewGetRoot( window( _wndRef ) ),  
kHIViewWindowContentID.signature, kHIViewWindowContentID.id,  
@contentView )
fn HITextViewCreate( hiRect, 0, 0, @txtView )
fn HIViewSetVisible( txtView, _true )
fn HIViewAddSubview( contentView, txtView )
fn SetKeyboardFocus( window( _wndRef ), txtView, _kControlEditTextPart )
end fn

edit menu 2
fn BuildWindow
poke long event - 8, 0xFFFFFFFF
do
HandleEvents
until gFBQuit
'--------------