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++ Widgets - General questions or Mixed problems » Propose a slight change to DropCoice/WithDropChoice
Propose a slight change to DropCoice/WithDropChoice [message #13358] Wed, 02 January 2008 23:13 Go to next message
tvanriper is currently offline  tvanriper
Messages: 85
Registered: September 2007
Location: Germantown, MD, USA
Member
I have this need, sometimes, to iterate over the items within a drop choice, and use that information in some fashion. In particular, I want to give the user the opportunity to modify a 'history' list in some fashion, and the information is generally only stored inside this control.

As of 712-dev1, I am unable to do this without modifying the DropChoice.h file to (safely) expose the underlying objects I need to acquire this information.

I don't see a particular reason why we cannot expose this information in the manner I expose it, so I wonder if we might update DropChoice.h accordingly?

I've included my altered header file.

The file contains the following changes:

to DropChoice (public):

int GetCount() const { return list.GetCount(); }
Value Get( int i ) const { return list.Get( i, 0 ); }


to WithDropChoice (public):

const DropChoice& GetDropChoice() const { return select; }


I hope this is useful.

EDIT

Bah... I had some errors. These should be corrected now, both in this message, and in the header file I've uploaded.. I failed to use the 'return' keyword in GetCount() and Get( int ). Silly me.
  • Attachment: DropChoice.h
    (Size: 9.82KB, Downloaded 325 times)

[Updated on: Thu, 03 January 2008 15:55]

Report message to a moderator

Re: Propose a slight change to DropCoice/WithDropChoice [message #13385 is a reply to message #13358] Thu, 03 January 2008 21:02 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
tvanriper wrote on Wed, 02 January 2008 17:13

I have this need, sometimes, to iterate over the items within a drop choice, and use that information in some fashion. In particular, I want to give the user the opportunity to modify a 'history' list in some fashion, and the information is generally only stored inside this control.

As of 712-dev1, I am unable to do this without modifying the DropChoice.h file to (safely) expose the underlying objects I need to acquire this information.

I don't see a particular reason why we cannot expose this information in the manner I expose it, so I wonder if we might update DropChoice.h accordingly?

I've included my altered header file.

The file contains the following changes:

to DropChoice (public):

int GetCount() const { return list.GetCount(); }
Value Get( int i ) const { return list.Get( i, 0 ); }


to WithDropChoice (public):

const DropChoice& GetDropChoice() const { return select; }


I hope this is useful.

EDIT

Bah... I had some errors. These should be corrected now, both in this message, and in the header file I've uploaded.. I failed to use the 'return' keyword in GetCount() and Get( int ). Silly me.


OK, why not. I have only slightly changed the idea by putting GetCount and Get directly to WithDropChoice.

Mirek
Re: Propose a slight change to DropCoice/WithDropChoice [message #18984 is a reply to message #13385] Mon, 03 November 2008 05:47 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

How to change width of dropped list of WithDropChoice control, but does not change the width Edit Control?

Now this:

index.php?t=getfile&id=1465&private=0

And I like:

index.php?t=getfile&id=1466&private=0

I must to create my own Control or I can edit WithDropChoice ?
What better way?


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Propose a slight change to DropCoice/WithDropChoice [message #19009 is a reply to message #18984] Wed, 05 November 2008 10:00 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Good idea, I have added

DropList::DropWidth[Z]

(and also fixed and updated DropList T++).

Coming to googlecode svn within hour.

Mirek
Re: Propose a slight change to DropCoice/WithDropChoice [message #19012 is a reply to message #19009] Wed, 05 November 2008 11:53 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Razz Thanks...

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Propose a slight change to DropCoice/WithDropChoice [message #19083 is a reply to message #19012] Mon, 10 November 2008 23:25 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

How Can I use it?

My Code:

//.Lay:

LAYOUT(ProjectDetailLayout, 340, 200)
	ITEM(Label, dv___0, SetLabel(t_("Nomenclature Name")).LeftPosZ(4, 80).TopPosZ(4, 19))
	ITEM(WithDropChoice<EditInt>, PRD_NomenclID, MaxChars(50).LeftPosZ(84, 56).TopPosZ(4, 19))
	ITEM(DropChoice, Pp, LeftPosZ(100, 56).TopPosZ(104, 15))
	ITEM(Label, dv___3, SetLabel(t_("Description")).LeftPosZ(4, 80).TopPosZ(32, 19))
	ITEM(EditString, PRD_NomenclAdditionDesc, HSizePosZ(84, 8).TopPosZ(32, 19))
	ITEM(Label, dv___5, SetLabel(t_("Quantity")).LeftPosZ(4, 80).TopPosZ(60, 19))
	ITEM(EditInt, PRD_Quantity, LeftPosZ(84, 80).TopPosZ(60, 19))
	ITEM(Button, ok, SetLabel(t_("OK")).RightPosZ(76, 64).BottomPosZ(8, 24))
	ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(8, 24))
	ITEM(EditString, PRD_NomenclID1, SetEditable(false).WantFocus(false).RightPosZ(8, 188).TopPosZ(4, 19))
END_LAYOUT


//And Code:

ProjectDetailDlg1::ProjectDetailDlg1() {
	CtrlLayoutOKCancel(*this, t_("Edit Project Item "));
	ctrls
		(PRD_NOMENCLID, PRD_NomenclID)
		(PRD_NOMENCLADDITIONDESC, PRD_NomenclAdditionDesc)
		(PRD_QUANTITY, PRD_Quantity)
	;
	
	NomenclDisplayLookup();
	PRD_NomenclID.Clear();
	PRD_NomenclID.WhenSelect <<THISBACK(ChildLostFocus);

	PRD_NomenclID.SetDisplay(Single<DisplayNomencl>());
	SQL * Select(NOM_ID, NOM_NAME).From(NOMENCL).OrderBy(NOM_NAME);
	while(SQL.Fetch())
		PRD_NomenclID.AddList(SQL[NOM_ID]);//,SQL[NOM_NAME]);
	
	Pp.SetDisplay(Single<DisplayNomencl>());
	SQL * Select(NOM_ID, NOM_NAME).From(NOMENCL).OrderBy(NOM_NAME);
	while(SQL.Fetch())
		Pp.Add(SQL[NOM_ID]);
	
	PRD_NomenclID.SetLineCy(PRD_NomenclID.GetSize().cy+2);
	//     <====I try to use this point PRD.NomenclID.DropWidth(35);
}


Compiler write
error: ‘class Upp::WithDropChoice<Upp::EditMinMax<int, Upp::ConvertInt> >’ has no
	 member named ‘DropWidth’

Maybe I don't understand about width of WithDropChoice<>..
Please HELP!!!


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Propose a slight change to DropCoice/WithDropChoice [message #19084 is a reply to message #19083] Mon, 10 November 2008 23:55 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

SOLVED!!!

I change some files in SVN 625.
I change DropChoihe.h and DropChoihe.cpp
New files in attachments.

Please enter same changes to official sources.

Thanks for good idea!!!


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
icon9.gif  Re: Propose a slight change to DropCoice/WithDropChoice [message #19155 is a reply to message #19084] Sat, 15 November 2008 15:50 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Mirek, can I ask you to include my changes to SVN the next version.

(I just added changes to the code DropChoice.cpp and DropChoice.h because I asked about the width of Control WithDropChoive <EnterInt>)

Thanks in advance. Sad


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}

[Updated on: Sat, 15 November 2008 15:57]

Report message to a moderator

Re: Propose a slight change to DropCoice/WithDropChoice [message #19165 is a reply to message #19155] Sun, 16 November 2008 13:28 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Ahh, sorry, originally I have only added this to DropList...

Going to do it now.

Mirek
Re: Propose a slight change to DropCoice/WithDropChoice [message #19170 is a reply to message #19165] Sun, 16 November 2008 17:44 Go to previous message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Very Very Thanks!!!

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Previous Topic: Refresh Layout
Next Topic: win32 multiscreen / multimonitor problem fix
Goto Forum:
  


Current Time: Fri Apr 19 13:47:24 CEST 2024

Total time taken to generate the page: 0.02173 seconds