1. xControls Issue with Tabs

Don, I think xControls might be getting bad rect values for tab controls.
But I don't know for sure. Check out this code and you'll see what I mean.

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 = createEx( List, "List7", TabItem4, 40, 44, 148, 120, 0, 0 ),
	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},{0.5,-5},{0.5,-5})

	setFocus(TabItem4)

WinMain( Window1,Normal )


-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » topic index » view message » categorize

2. Re: xControls Issue with Tabs

cklester wrote:
> 
> Don, I think xControls might be getting bad rect values for tab controls.
> But I don't know for sure. Check out this code and you'll see what I mean.
> 
> }}}
<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 = createEx( List, "List7", TabItem4, 40, 44, 148, 120, 0, 0 ),
> 	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},{0.5,-5},{0.5,-5})
> 
> 	setFocus(TabItem4)
> 
> WinMain( Window1,Normal )
> </eucode>
{{{

> 
> -=ck
> "Programming in a state of EUPHORIA."
> <a
> href="http://www.cklester.com/euphoria/">http://www.cklester.com/euphoria/</a>
> 

CK,

What is it you're trying to accomplish?  If you comment out the manage()
call for List7 then it appears in the correct spot in the tab item.

Are you trying to get List7 to shrink/expand with changes to the main
window's size?

Jonas Temple
http://www.yhti.net/~jktemple

new topic     » goto parent     » topic index » view message » categorize

3. Re: xControls Issue with Tabs

Jonas Temple wrote:
 
> Are you trying to get List7 to shrink/expand with changes to the main
> window's size?

I want it to shrink/expand with changes to the parent
tab's size. And it <i>almost</i> does this, except the top
coordinate is wrong. Instead of using a point inside the tab item/control,
it uses a point in front of the tab itself. Now, I can manage this myself
by using {0,25} for the "top" coordinate, but I shouldn't have to make
that kind of adjustment. If I use {.5,-5} for the "top" coordinate, it
will be WRONG because the "top" isn't '1,' but it's really '25' (or so).
See what I mean? Hope that's clear. :)

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

4. Re: xControls Issue with Tabs

cklester wrote:
> 
> I want it to shrink/expand with changes to the parent
> tab's size. And it <i>almost</i> does this, except the top
> coordinate is wrong. Instead of using a point inside the tab item/control,
> it uses a point in front of the tab itself. Now, I can manage this myself
> by using {0,25} for the "top" coordinate, but I shouldn't have to make
> that kind of adjustment. If I use {.5,-5} for the "top" coordinate, it
> will be WRONG because the "top" isn't '1,' but it's really '25' (or so).
> See what I mean? Hope that's clear. :)
> 
CK,

Yep, you're right!  I do remember running into this problem in the past.
In my case, I just made the tab control a static size and let the rest
of the controls on the window change size/position.  

Maybe Don can take a look at this...lemme see if I can get him...Don???
Don???? Hello?  Hmmmm...I'll leave a message:

Don, in addition to CK, I would like the ability to change the size
of child controls in a tab control.  Thanks.

Sorry...too much coffee today.

Jonas Temple
http://www.yhti.net/~jktemple

new topic     » goto parent     » topic index » view message » categorize

5. Re: xControls Issue with Tabs

cklester wrote:
> 
> I want it to shrink/expand with changes to the parent
> tab's size. And it <i>almost</i> does this, except the top
> coordinate is wrong. Instead of using a point inside the tab item/control,
> it uses a point in front of the tab itself. Now, I can manage this myself
> by using {0,25} for the "top" coordinate, but I shouldn't have to make
> that kind of adjustment. If I use {.5,-5} for the "top" coordinate, it
> will be WRONG because the "top" isn't '1,' but it's really '25' (or so).
> See what I mean? Hope that's clear. :)
> 

CK,

The following works, if you're interested.  I have a feeling that it
won't work if you have more than one control on the window (besides
the tab control)

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 = createEx( List, "List7", TabItem4, 40, 44, 148, 120, 0, 0 ),
	TabItem5 = createEx( TabItem, "TabItem5", TabControl2, 0, 0, 0, 0, 0, 0 ),
	TabItem6 = createEx( TabItem, "TabItem6", TabControl2, 0, 0, 0, 0, 0, 0 ),

	-- xcontrols	
	gmid = xControl( Geometry, "", Window1, 0, 0, 0, 0, 0, 0 )

	manage(gmid,TabControl2,{0,25},{0,25},{1,-25},{1,-25})
	manage(gmid,List7,{0,5},{0,25},{1,-60},{1,-60})

	setFocus(TabItem4)

WinMain( Window1,Normal )


Jonas Temple
http://www.yhti.net/~jktemple

new topic     » goto parent     » topic index » view message » categorize

6. Re: xControls Issue with Tabs

Jonas Temple wrote:
> 
> The following works, if you're interested.  I have a feeling that it
> won't work if you have more than one control on the window (besides
> the tab control)

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.

I think xControls should manage all this automagically. :)

include Win32Lib.ew
include xcontrols.ew

integer top, htop
	top = 25
	htop = floor(top/4)
	
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,top},{0.5,-5},{0.5,-htop+5})
	manage(xControl_TabControl2,List8,{0,5},{.5,htop-5},{0.5,-5},{1,-5})

	setFocus(TabItem4)

WinMain( Window1,Normal )


-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

7. Re: xControls Issue with Tabs

> > The following works, if you're interested.  I have a feeling that it
> > won't work if you have more than one control on the window (besides
> > the tab control)
> 
> 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.
> 
> I think xControls should manage all this automagically. :)

Punks =)
Buncha xControls spammers!  Lol.  Lemme poke around with the code tonight
and I will see whats going on.  I can always come up with some kind of
fix.  Sounds easy enough from what I read, but the code snips will help.
Thanks for those.

CK:
I will look at your as well.


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

new topic     » goto parent     » topic index » view message » categorize

8. Re: xControls Issue with Tabs

> > 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 message » categorize

9. Re: xControls Issue with Tabs

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

Doesn't work good... Works great!!! :)

Thank you sir!!!

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

10. Re: xControls Issue with Tabs

Don wrote:
> 
> First draft.  If this works good ill patch an update through.
> Replace procedure GM_Manager with this:
> 
> Don Phillips - aka Graebel
>      National Instruments
>      mailto: eunexus @ yahoo.com
> 
Don,

Just curious...would this work with group controls as well?

Jonas

Jonas Temple
http://www.yhti.net/~jktemple

new topic     » goto parent     » topic index » view message » categorize

11. Re: xControls Issue with Tabs

> Just curious...would this work with group controls as well?
> 
> Jonas

I doubt it.  The fix was rather specific.  I have never had to use tab
controls in any of my applications before so I never knew that the "tabs"
were actually part of the client area.  It was more along the lines of a
Windows quirk than an actual error in the code.  If there are similar
problems with group controls I can look at those also.


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

new topic     » goto parent     » topic index » view message » categorize

12. Re: xControls Issue with Tabs

> I doubt it.  The fix was rather specific.  I have never had to use tab
> controls in any of my applications before so I never knew that the "tabs"
> were actually part of the client area.  It was more along the lines of a
> Windows quirk than an actual error in the code.  If there are similar
> problems with group controls I can look at those also.

Nods, I looked and Group controls were also broken.  They work now also.
I posted the fixes up to RDS along with support for icon files for the Menu
library.

Enjoy...


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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu