Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - [solved]wrong serialization in CXTPControlComboBox
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[solved]wrong serialization in CXTPControlComboBox

 Post Reply Post Reply
Author
Message Reverse Sort Order
olebed View Drop Down
Admin Group
Admin Group
Avatar

Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 751
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Topic: [solved]wrong serialization in CXTPControlComboBox
    Posted: 08 December 2017 at 3:15pm
Hello,

We fixed this with
    int nUnusedWidth = m_nWidth;
    PX_DPI_X_Int(pPX, _T("Width"), nUnusedWidth, 0);

Regards,
 Oleksandr Lebed
Back to Top
mschumi View Drop Down
Groupie
Groupie


Joined: 21 May 2007
Location: Germany
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote mschumi Quote  Post ReplyReply Direct Link To This Post Posted: 06 December 2017 at 12:01pm
Hi Codejock Team,

the width related code in
void CXTPControlComboBox::DoPropExchange(CXTPPropExchange* pPX)
{
    CXTPControlPopup::DoPropExchange(pPX);

    PX_Bool(pPX, _T("DropDown"), m_bDropDown, TRUE);

    // The Width property is already serialized in CXTPControl
    // so in order to avoid double DPI scaling it must not be read twice (ticket 35575),
    // however the value still must be read out to provide format backward compatibility (ticket 36079).
    int nUnusedWidth = 0;
    PX_DPI_X_Int(pPX, _T("Width"), nUnusedWidth, 0);
    UNUSED(nUnusedWidth);
    ...

is not correct, once again.
In XTP1700
PX_DPI_X_Int(pPX, _T("Width"), m_nWidth, 0) was called twice; the two writes did no harm but the two reads somehow changed the member in case of HighDPI (when XTP_DPI_X returns a modified value)

In XTP1801
PX_DPI_X_Int(pPX, _T("Width"), m_nWidth, 0) was called only once (in the base class) and for us, everything was fine (serializing to XML)

In XTP1820
- PX_DPI_X_Int(pPX, _T("Width"), m_nWidth, 0) is called in the base class
- PX_DPI_X_Int(pPX, _T("Width"), nUnusedWidth, 0) is called again in CXTPControlComboBox::DoPropExchange
Now writing is buggy:
- the base class (CXTPControl) writes e.g. Width=150 into xml
- the derived class (CXTPControlComboBox) writes Width=0 into xml and... gone is the 150

My guess is the code in the derived class should only be called in the read case (IsLoading=true)

I would appreciate it very much if the bug was fixed in the next version.

Thank you and best regards,
Michael
Back to Top
jis View Drop Down
Groupie
Groupie


Joined: 28 September 2015
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote jis Quote  Post ReplyReply Direct Link To This Post Posted: 06 December 2017 at 8:04am
Ive done some, and it seems that if we do not load commandbars on launch, then the CXTPControlComboBox have a width that normal.
But when we load the commandbars the CXTPControlComboBox have a width of 0.
It looks like all combos in the XML file look like this:

<Control Class="CXTPControlComboBox" Type="5" Id="7005" HideFlags="128" TooltipText="Control Text" Width="0" Height="0" CommandBarId="16777260" DropDown="0"/>
while in 16.4 of CodeJock this combobox would have Width="128".

Possibly related to: http://forum.codejock.com/forum_posts.asp?TID=23508&KW=ComboBox&title=1820-wrong-serialization-in-cxtpcontrolcombobox ?
Back to Top
jis View Drop Down
Groupie
Groupie


Joined: 28 September 2015
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote jis Quote  Post ReplyReply Direct Link To This Post Posted: 05 December 2017 at 11:03am
We have seen a similar issue with 18.2.0 where ComboBoxes have almost no width.
Back to Top
lrenoux View Drop Down
Groupie
Groupie


Joined: 20 April 2009
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote lrenoux Quote  Post ReplyReply Direct Link To This Post Posted: 28 November 2017 at 4:29am
In save mode (schema _XTP_SCHEMA_1700), the code below is wrong, "Width" will always be saved with 0.

void CXTPControlComboBox::DoPropExchange(CXTPPropExchange* pPX)
{
CXTPControlPopup::DoPropExchange(pPX);

PX_Bool(pPX, _T("DropDown"), m_bDropDown, TRUE);

// The Width property is already serialized in CXTPControl
// so in order to avoid double DPI scaling it must not be read twice (ticket 35575),
// however the value still must be read out to provide format backward compatibility (ticket 36079).
int nUnusedWidth = 0;
PX_DPI_X_Int(pPX, _T("Width"), nUnusedWidth, 0);
UNUSED(nUnusedWidth);

Introduced in version 18.2. I don't understand the comment.


L.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.078 seconds.