[futurebasic] Re: [FB] Static edit field problems

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2002 : Group Archive : Group : All Groups

From: Jay <jktr@...>
Date: Wed, 22 May 02 09:03:36 -0500
>The follow code to change edit fields currently works and has always worked
>in non-appearance windows to change edit fields that were originally created
>as static or non-static (of course _useplainframe and _nodrawfocus are not
>used in non appearance applications).
>
>Am I doing something wrong or is this a bug?
>
Doug,

Yet another thought--

Is there anything behind your fields--even a little bit of them? If so, they may need to be embedded in whatever is behind. Here is the FAQ I recently wrote on embedding, in case it might be useful.

 e-e
 =J= a  y
  "

Appearance EMBED FAQ

Q: Why aren't my Appearance buttons and edit fields receiving clicks and keystrokes?

A: Chances are, you have them on top of (i.e., in front of) other objects. Under Appearance, events seem to work their way up from the bottom layer. A background picture, for instance, can shield any field or button placed in front of it from receiving events.

Q: So what do I need to do?

A: Embed. When you embed an object in the object behind it (or enclosing it), it's as if you poke a hole in the rear object so events can get through. FB provides the DEF EMBEDBUTTON statement for embedding one button in another.

Q: Okay, but DEF EMBEDBUTTON won't accept edit fields or picture fields. How can I embed them, or embed other objects in them?

A: Robert Purves and Robin Craig have generously provided 5 additional FNs (code follows) that will cover most instances for R6. (They may be included as part of later releases):
  € FN EmbedEFinBtn( EFnum, BtnNum )
  € FN EmbedPFinBtn( PFnum, BtnNum )
  € FN EmbedEFinPF ( EFnum, PFnum )
  € FN EmbedPFinPF ( PFnum, PFreceiverNum )
  € FN EmbedBtnInPF( BtnNum, PFnum )

Q: Great--I've embedded all my edit fields, picture fields, and buttons in a background picture, but still nothing works. Now what?

A: All objects in which the event-receiving object is embedded must be active. For a picture field to be active, it must be designated as _clickable. (A non-clickable PF is simply inactive, and anything imbedded in it will inherit its sedentary ways.) So even if you have no intention of having your background picture receive clicks, make it clickable if you want anything embedded in it to get them.

Here are the auxiliary EMBED FNs. I've added a wrapper for DEF EMBEDBUTTON, to fit the syntax of the others, and formatted them as an INCL file you can drop into your project.

 e-e
 =J= a  y
  "

'~Appearance EMBED FNs.INCL
goto "End of Appearance EMBED FNs.INCL"
'To use with OSX, remove //'s

local mode
dim as ControlRef pFPane
dim as OSErr      err
local fn EmbedBtnInPF( btnNum as long, pfNum as long )
'
//IF _OSXrcdbOn THEN FN OSXrcdbtFn("EmbedButtoninPF",1)
pFPane = fn FindPictField( pfNum,  window( _wndPointer ) )
err = fn EmbedControl( button&( btnNum ), pFPane )
if err then stop "EmbedBtnInPF error " + str$( err )
//IF _OSXrcdbOn THEN FN OSXrcdbtFn("",1)
end fn

local mode
dim efPaneControlRef as handle
dim err              as OSErr
local fn EmbedEFinBtn(  efNum as long, btnNum as long )
'
//IF _OSXrcdbOn THEN FN OSXrcdbtFn("EmbedEFinButton",1)
efPaneControlRef = fn FBFindEF( efNum, _allEFSubClasses, 0 )
err = fn EmbedControl( efPaneControlRef, button&( btnNum ) )
if err then stop "EmbedEFinBtn error " + str$( err )
//IF _OSXrcdbOn THEN FN OSXrcdbtFn("",1)
end fn

local mode
dim efPaneControlRef as handle
dim pfPaneControlRef as handle
dim wref             as WindowRef
dim err              as OSErr
local fn EmbedEFinPF(  efNum as long, pfNum as long )
'
//IF _OSXrcdbOn THEN FN OSXrcdbtFn("EmbedEFinPF",1)
wref = WINDOW(_wndRef)
efPaneControlRef = fn FBFindEF( efNum, _allEFSubClasses, 0 )
pfPaneControlRef = fn FindPictField( pfNum, wref )//this is in Rntm
err = fn EmbedControl( efPaneControlRef, pfPaneControlRef )
if err then stop "EmbedEFinPF error " + str$( err )
//IF _OSXrcdbOn THEN FN OSXrcdbtFn("",1)
end fn

local mode
dim pfPaneControlRef as handle
dim wref             as WindowRef
dim err              as OSErr
local fn EmbedPFinBtn( pfNum as long, btnNum as long )
'
//IF _OSXrcdbOn THEN FN OSXrcdbtFn("EmbedPFInButton",1)
wref = WINDOW(_wndRef)
pfPaneControlRef = fn FindPictField( pfNum, wref )
err = fn EmbedControl( pfPaneControlRef, button&( btnNum ) )
if err then stop "EmbedPFinBtn error " + str$( err )
//IF _OSXrcdbOn THEN FN OSXrcdbtFn("",1)
end fn

local mode
dim pfPaneControlRefS as handle
dim pfPaneControlRef  as handle
dim wref              as WindowRef
dim err               as OSErr
local fn EmbedPFInPF( pfNumSub as long, pfNumHolder as long )
'
//IF _OSXrcdbOn THEN FN OSXrcdbtFn("EmbedPFInPF",1)
wref = WINDOW(_wndRef)
pfPaneControlRefS = fn FindPictField( pfNumSub, wref )
pfPaneControlRef  = fn FindPictField( pfNumHolder, wref )
err = fn EmbedControl( pfPaneControlRefS, pfPaneControlRef )
if err then stop "EmbedPFinPF error " + str$( err )
//IF _OSXrcdbOn THEN FN OSXrcdbtFn("",1)
end fn

local mode
local fn EmbedBtnInBtn( btnNumSub, btnNumHolder )
'
'Wrapper for matching syntax
DEF EMBEDBUTTON( btnNumSub, btnNumHolder )
END FN
'
"End of Appearance EMBED FNs.INCL"