Eugen wrote:

Why, in the example bellow, I can not anchor the borders of the edit field,
using "FN ViewBindToParent( button&(10), _true, _true, _true, _true )”, when I reside the window ?

You need to bind each tab pane to its parent.

btw, in this amended code, GetTabContentRect is used to get the recommended tab pane rect.

// ---------------
include "Tlbx HIView.incl"
include "Tlbx ControlDefinitions.incl"

_myWindow = 1
_wndW = 650
_wndH = 940
_tab = 100
_tabCount = 2
begin enum 1
_pane1
_pane2
end enum

LOCAL
     dim as HILayoutInfo   layout
LOCAL FN ViewBindToParent( view as HIViewRef, left as Boolean, top as Boolean, right as Boolean, bottom as Boolean )
'~'1
layout.version = _kHILayoutInfoVersionZero
fn HIViewGetLayoutInfo( view, @layout )
if ( top ) then layout.binding.top.kind = _kHILayoutBindTop
if ( left ) then layout.binding.left.kind = _kHILayoutBindLeft
if ( bottom ) then layout.binding.bottom.kind = _kHILayoutBindBottom
if ( right ) then layout.binding.right.kind = _kHILayoutBindRight
fn HIViewSetLayoutInfo( view, @layout )
END FN
'~'5

LOCAL
     dim as Rect                     r
     dim as ControlTabInfoRec        infoRec
     dim as WindowAttributes         attr
     dim as short                    x
     dim as str15                    tabTitleStr(_tabCount)
     DIM AS HIContentBorderMetrics   border
     DIM AS WindowRef                w
     tabTitleStr(1) = "Tab1" : tabTitleStr(2) = "Tab2"
LOCAL FN BuildWindow
'~'1
attr  = _kWindowStandardFloatingAttributes
attr += _kWindowStandardHandlerAttribute
attr += _kWindowResizableAttribute
attr += _kWindowCompositingAttribute
attr += _kWindowLiveResizeAttribute
attr += _kWindowFullZoomAttribute
attr += _kWindowHasRoundBottomBarCornersAttribute

// **** Compositing window **** //
SetRect( @r, 0, 44, _wndW, _wndH )
appearance window -_myWindow, @"Untitled", @r, _kDocumentWindowClass, attr
FN SetWindowBackground( _kThemeActiveDialogBackgroundBrush, _True )
FN NewWindowPositionMethod(0)

// **** Tab control **** //
SetRect( @r, 20, 400, _wndW-19, _wndH-93 )
appearance button _tab, -_activeBtn, 0, 0, _tabCount,, @r, _kControlTabSmallProc

//InsetRect( @r, 0, -400 )
//r.top += 35
fn GetTabContentRect( button&(_tab), @r )
for x = 1 to _tabCount
infoRec.version = _kControlTabInfoVersionZero
infoRec.iconSuiteID = 0
infoRec.name = tabTitleStr(x)
FN SetButtonData( _tab, x, _kControlTabInfoTag, sizeof( infoRec ), infoRec )
long if x == 1
APPEARANCE BUTTON x,,_kControlSupportsEmbedding,,,, @r, _kControlUserPaneProc // visible
xelse
APPEARANCE BUTTON -x,,_kControlSupportsEmbedding,,,, @r, _kControlUserPaneProc // invisible
end if
FN EmbedButton( x, _tab )
fn ViewBindToParent( button&(x), _true, _true, _true, _true )
next
fn ViewBindToParent( button&(_tab), _true, _true, _true, _true )
BUTTON _tab, _activeBtn

'~Min/Max Window
w = window( _wndRef )
border.top = 0.0
border.left = 0.0
border.bottom = 30.0
border.right = 0.0
FN HIWindowSetContentBorderThickness( w, @border )
MinWindow _wndW, _wndH - 45
MaxWindow system(_scrnWidth) - 140, SYSTEM( _scrnHeight ) - 150
// **** Create an edit field inside tab 1 **** //
SetRect( @r, 0, 0, 400, 200 )
EDIT FIELD 10, @"A text", @r, _framed
FN EmbedButton( 10, _pane1 )
FN ViewBindToParent( button&(10), _true, _true, _true, _true )// Here’s the problem.
window _myWindow
end FN
'~'5

FN BuildWindow
RunApplicationEventLoop()
// ---------------






--
To unsubscribe, send ANY message to: futurebasic-unsubscribe@... To access the list archives, go to: http://freegroups.net/groups/futurebasic/