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  |
 |
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 369 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   |
 |
mirek
Messages: 14255 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 #19083 is a reply to message #19012] |
Mon, 10 November 2008 23:25   |
|
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 );
}
|
|
|
|
|
|
|
Goto Forum:
Current Time: Mon Apr 28 00:55:08 CEST 2025
Total time taken to generate the page: 0.00861 seconds
|