Re: xControls Issue with Tabs

new topic     » goto parent     » topic index » view thread      » older message » newer message

> > Here's a version that ALMOST works perfectly. As you can see, even though
> > I'm supposedly splitting the area 50/50 for each list box, the one on top
> > is shorter than the one on bottom.

First draft.  If this works good ill patch an update through.
Replace procedure GM_Manager with this:

[eucode]
-- procedure: GM_Manager [win32 callback loop]
-------------------------------------
procedure GM_Manager( integer parentID, integer event, sequence params )
	sequence newPos, attribs, classType, Rect
    sequence Offset
	integer width, height
	atom Void
    atom TRect

    Offset = {0,0}
    Rect = getClientRect( parentID )
	classType = getControlInfo( parentID, {CONTROLINFO_class} )
    if classType[1] != 0 then
        if classType[1] = 11 then -- tab control
            TRect = allocate( 16 )
            poke4( TRect, Rect[1..4] )
            Void = sendMessage( parentID, TCM_ADJUSTRECT, 0, TRect )
            Rect = peek4u( {TRect,4} ) & Rect[5..6]
            free( TRect )
            Offset = Rect[1..2]
            Rect[6] -= Rect[2]
            Rect[4] -= Rect[2]
            Rect[5] -= Rect[1]
            Rect[3] -= Rect[1]
            Rect[1..2] = {0,0}
        end if
    end if
	params[2..3] = Rect[3..4]

	if Rect[2] != 0 then
		params[3] = Rect[6]
	end if

	if onResize[parentID] != -1 then
		call_proc( onResize[parentID], params )
	end if

	if params[1] != SIZE_MINIMIZED then
		newPos = repeat( 0, 6 )
		if length(IDsManaged[parentID]) > 0 then
			w32Proc( gmLockWindowUpdate, {parentID} )

			for index = 1 to length(IDsManaged[parentID]) do
				attribs = IDsManaged[parentID][index]
				for index2 = 1 to 4 do
					if attribs[index2+1][1] <= 1
then newPos[index2] = floor(
params[and_bits(or_bits(xor_bits(index2,1),2),3)] * attribs[index2+1][1] )
else newPos[index2] = PrevPlaced[ attribs[index2+1][1] ][
index2+2-(index2>2)*4 ]
					end if
					newPos[index2] += attribs[index2+1][2]
					PrevPlaced[ attribs[1] ][index2] = newPos[index2]
				end for
				newPos[5] = newPos[3] - newPos[1]
				newPos[6] = newPos[4] - newPos[2]

setRect( attribs[1], newPos[1]+Offset[1], newPos[2]+Offset[2], newPos[5],
newPos[6], True )
				classType = getControlInfo( attribs[1], {CONTROLINFO_class} )
				if classType[1] = 2 then -- 2 = COMBO
					Void = sendMessage( attribs[1], CB_SETDROPPEDWIDTH, newPos[5], 0 )
				else
				end if
			end for
			w32Proc( gmLockWindowUpdate, {0} )
		end if
	end if
end procedure
[/eucode]

And you can test it with this:

[eucode]
include Win32Lib.ew
include xcontrols.ew

constant
	-- windows and controls
	Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300, 0, 0 ),
TabControl2 = createEx( TabControl, "TabControl2", Window1, 24, 8, 300, 232, 0,
0 ),
	TabItem3 = createEx( TabItem, "TabItem3", TabControl2, 0, 0, 0, 0, 0, 0 ),
	TabItem4 = createEx( TabItem, "TabItem4", TabControl2, 0, 0, 0, 0, 0, 0 ),
List7 = create( List, "List7", TabItem4, 40, 44, 148, 120, LBS_NOINTEGRALHEIGHT
),
List8 = create( List, "List7", TabItem4, 40, 44, 148, 120, LBS_NOINTEGRALHEIGHT
),
	TabItem5 = createEx( TabItem, "TabItem5", TabControl2, 0, 0, 0, 0, 0, 0 ),
	TabItem6 = createEx( TabItem, "TabItem6", TabControl2, 0, 0, 0, 0, 0, 0 ),

	-- xcontrols	
	xControl_Window1 = xControl( Geometry, "", Window1, 0, 0, 0, 0, 0, 0 ),
	xControl_TabControl2 = xControl( Geometry, "", TabControl2, 0, 0, 0, 0, 0, 0 )

	manage(xControl_Window1,TabControl2,{0,5},{0,5},{1,-5},{1,-5})
	manage(xControl_TabControl2,List7,{0,5},{0,5},{1,-5},{0.5,-5})
	manage(xControl_TabControl2,List8,{0,5},{0.5,5},{1,-5},{1,-5})

	setFocus(TabItem4)

WinMain( Window1,Normal )
[/eucode]


Don Phillips - aka Graebel
     National Instruments
     mailto: eunexus @ yahoo.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu