Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » [BUG] Ctrl::AlignRight
[BUG] Ctrl::AlignRight [message #14551] Mon, 03 March 2008 16:01 Go to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
When I set AlignRight in the Designer for an EditString item, the compiler doesn't like it.

Nick
Re: [BUG] Ctrl::AlignRight [message #14552 is a reply to message #14551] Mon, 03 March 2008 16:51 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Not enough information. It works for me, although there is a bug that means that you can't use SetFont and tool tips together (.Tip gets added first).

Can you post the relevant portion of the .lay file?

Re: [BUG] Ctrl::AlignRight [message #14604 is a reply to message #14552] Tue, 04 March 2008 14:50 Go to previous messageGo to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
The error I get is

D:\MyApps\OpenWind/Optimiser.lay(11) : error C2039: 'AlignRight' : is not a member of 'Upp::Ctrl'
        C:\upp\uppsrc\CtrlCore/CtrlCore.h(308) : see declaration of 'Upp::Ctrl'
        C:\upp\uppsrc\CtrlCore/TopWindow.h(232) : see reference to function template instantiation 'void InitLayout<T,T>(Upp::Ctrl &,L &,D &,OptimiserProgressLayout__layid &)' being compiled
        with
        [
            T=OptimiserProgress,
            L=OptimiserProgress,
            D=OptimiserProgress
        ]
        C:\upp\uppsrc\CtrlCore/TopWindow.h(240) : see reference to function template instantiation 'void Upp::CtrlLayout<T>(T &)' being compiled
        with
        [
            T=OptimiserProgress
        ]
        d:\myapps\openwind\Optimiser.h(39) : see reference to function template instantiation 'void Upp::CtrlLayout<OptimiserProgress>(T &,const char *)' being compiled
        with
        [
            T=OptimiserProgress
        ]
D:\MyApps\OpenWind/Optimiser.lay(11) : error C2228: left of '.SetEditable' must have class/struct/union
D:\MyApps\OpenWind/Optimiser.lay(11) : error C2228: left of '.LeftPosZ' must have class/struct/union
D:\MyApps\OpenWind/Optimiser.lay(11) : error C2228: left of '.TopPosZ' must have class/struct/union


My layout file for this class is

LAYOUT(OptimiserProgressLayout, 780, 156)
	ITEM(Label, dv___0, SetLabel(t_("Iterations")).LeftPosZ(12, 96).TopPosZ(32, 19))
	ITEM(EditInt, m_nTurbs, WantFocus(false).SetEditable(false).LeftPosZ(116, 56).TopPosZ(8, 19))
	ITEM(EditInt, m_nIterations, WantFocus(false).SetEditable(false).LeftPosZ(116, 56).TopPosZ(32, 19))
	ITEM(EditString, m_fArrayLoss, WantFocus(false).SetEditable(false).LeftPosZ(116, 56).TopPosZ(128, 19))
	ITEM(EditString, m_fCF, WantFocus(false).SetEditable(false).LeftPosZ(116, 56).TopPosZ(104, 19))
	ITEM(Option, optionGrossE, SetLabel(t_("Gross Energy")).LeftPosZ(12, 96).TopPosZ(80, 19))
	ITEM(Label, optionCF, SetLabel(t_("Capacity Factor")).LeftPosZ(12, 96).TopPosZ(104, 19))
	ITEM(Option, optionNetE, SetLabel(t_("Net Energy")).LeftPosZ(12, 96).TopPosZ(56, 20))
	ITEM(EditString, m_fGrossE, WantFocus(false).SetEditable(false).LeftPosZ(116, 56).TopPosZ(80, 19))
	ITEM(EditString, m_fNetE, WantFocus(false).AlignRight(true).SetEditable(false).LeftPosZ(116, 56).TopPosZ(56, 19))
	ITEM(Option, optionArrayLosses, SetLabel(t_("Array Losses")).LeftPosZ(12, 96).TopPosZ(128, 19))
	ITEM(OPLabel, opLabel, HSizePosZ(216, 12).VSizePosZ(32, 8))
	ITEM(Label, dv___12, SetLabel(t_("Turbines")).LeftPosZ(12, 60).TopPosZ(8, 19))
	ITEM(Label, dv___13, SetLabel(t_("MWh/yr")).LeftPosZ(176, 40).TopPosZ(80, 19))
	ITEM(Label, dv___14, SetLabel(t_("%")).LeftPosZ(176, 40).TopPosZ(104, 19))
	ITEM(Label, dv___15, SetLabel(t_("%")).LeftPosZ(176, 40).TopPosZ(128, 19))
	ITEM(Label, dv___16, SetLabel(t_("MWh/yr")).LeftPosZ(176, 40).TopPosZ(56, 19))
END_LAYOUT


Any ideas?

Nick
Re: [BUG] Ctrl::AlignRight [message #14605 is a reply to message #14604] Tue, 04 March 2008 15:08 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
Hi Nick,

I think it should rather be:
	ITEM(EditString, m_fNetE, AlignRight(true).WantFocus(false).SetEditable(false).LeftPosZ(116, 56).TopPosZ(56, 19))
, since WantFocus() return reference to Ctrl and not to EditField which in turn defines AlignRight().

Matthias
Re: [BUG] Ctrl::AlignRight [message #14606 is a reply to message #14604] Tue, 04 March 2008 15:10 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Fix:

Change CtrlLib/CtrlLib.usc starting line 422 from:
	Frame SetFrame = InsetFrame();
	Font  SetFont = StdFont();
	bool  SetEditable = true @1 ? "Editable";
	bool  WantFocus = true;
	int   MaxChars;
	bool  AlignRight;
	Text  Tip;
to:
	bool  AlignRight @1;
	int   MaxChars @2;
	Font  SetFont = StdFont() @3;
	bool  SetEditable = true @4 ? "Editable";
	Frame SetFrame = InsetFrame() @5;
	Text  Tip @6;
	bool  WantFocus = true @7;

After that you will have to get the Layout manager to refresh the .lay file. Changing from text/layout should work, but setting then clearing WantFocus for each ctrl will definitely work.

The number after the @ char determines the order that the calls get added to the .lay file. If missing the order they are listed determines the order, but this sometimes seems to go wrong, and most of the Upp ctrls don't have the ordering explicitly stated.

James

[Updated on: Tue, 04 March 2008 15:17]

Report message to a moderator

Re: [BUG] Ctrl::AlignRight [message #14610 is a reply to message #14606] Tue, 04 March 2008 15:33 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thanks, patched.
Re: [BUG] Ctrl::AlignRight [message #14612 is a reply to message #14610] Tue, 04 March 2008 15:39 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Cool. This seems to be a recurring problem (I think I've seen it mentioned before anyway), and is linked to this line in ide/LayDes/item.cpp:
	Vector<int> o = GetSortOrder(property, FieldRelation(&ItemProperty::level, StdLess<int>()));

Presumably the intent here is to leave all properties that haven't had a specific order set (have level = 0) in the same relative place in the list. Is it possible that the algorithm used for sorting here is moving them?

That would explain the problem, but it might be easier/more sensible just to add fixed orders to all the properties anyway.

[Updated on: Tue, 04 March 2008 15:39]

Report message to a moderator

Re: [BUG] Ctrl::AlignRight [message #14615 is a reply to message #14606] Tue, 04 March 2008 17:05 Go to previous message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Thanks. I will wait for the next beta update. for now I just added it explicitly.

Cheers,

Nick
Previous Topic: Date Scan Problem
Next Topic: ChatClient with Ultimate++
Goto Forum:
  


Current Time: Fri Mar 29 12:28:31 CET 2024

Total time taken to generate the page: 0.01805 seconds