Home > Software engineering >  Duilib interface development problems
Duilib interface development problems

Time:09-23

I want to be a similar subway site information on the interface, and then do a Combo under control, add the site name, site inside choice, and then through a Button Button to determine the site of choice, implementation on the function of the corresponding interface, such as the currently selected sites to red, a site before and after a site is black, the previous site before all grey,
 # pragma once 

#include
#include
Using the namespace DuiLib;

# ifdef _DEBUG
# ifdef _UNICODE
# pragma comment (lib, "DuiLib_ud. Lib")
# the else
# pragma comment (lib, "DuiLib_d. Lib")
# endif
# the else
# ifdef _UNICODE
# pragma comment (lib, "DuiLib_u. Lib")
# the else
# pragma comment (lib, "DuiLib. Lib")
# endif
# endif
Struct station {
Char StationName [13].
COptionUI * pOption;
CButtonUI * pLabel;
};

The class CDuiFrameWnd: public WindowImplBase
{
Public:
Virtual LPCTSTR GetWindowClassName const () {return _T (" DUIMainFrame "); }
Virtual CDuiString GetSkinFile () {return _T (" Qtitle. XML "); }
Virtual CDuiString GetSkinFolder () {return _T (" "); }


Void Init ()
{
Struct station cStation cStation1, cStation2 cStation3, cStation4, cStation5, cStation6;

Strcpy (cStation StationName, "Buddha ridge");
Strcpy (cStation1 StationName, "high five");
Strcpy (cStation2 StationName, "high road 4");
Strcpy (cStation3 StationName, "remain park avenue s.e.");
Strcpy (cStation4 StationName, "engineering university");
Strcpy (cStation5 StationName, "optical valley boulevard");
Strcpy (cStation6 StationName, "contemporary international garden");
P_surebtn=static_cast & lt; CButtonUI * & gt; (m_pm. FindControl (_T (" StationChoice ")));
//here for the pointer may be empty, can the breakpoint to see
CComboUI * pAccountCombo=static_cast & lt; CComboUI * & gt; (m_pm. FindControl (_T (" StationMess ")));
CEditUI * pAccountEdit=static_cast & lt; CEditUI * & gt; (m_pm. FindControl (_T (" accountedit ")));
//pointer to judge, if the pointer is null, direct manipulation will collapse? So all you need to determine, program robustness
If (pAccountCombo & amp; & PAccountEdit) pAccountEdit - & gt; SetText (pAccountCombo - & gt; The GetText ());
PAccountEdit - & gt; SetFocus ();

}
Void OnPrepare () {
CComboUI * pStationCombo=static_cast & lt; CComboUI * & gt; (m_pm. FindControl (_T (" StationMess ")));

}
//duilib window initialization function
Virtual void InitWindow ()
{
//SendMessage (WM_SYSCOMMAND, SC_MAXIMIZE, 0);//window to maximize
}
Virtual void Notify (TNotifyUI& MSG)
{

If (MSG) sType==_T (" click "))
{
If (MSG. PSender - & gt; GetName ()==_T (" p_surebtn "))
{
COptionUI * pControl=static_cast & lt; COptionUI * & gt; (m_pm. FindControl (_T (" StationChoice ")));

}
}
Else if (MSG. SType==_T (" itemselect "))
{
If (MSG. PSender - & gt; GetName ()==_T (" StationMess "))
{
//code has a problem, m_pm uninitialized???????
CComboUI * pAccountCombo=static_cast & lt; CComboUI * & gt; (m_pm. FindControl (_T (" StationMess ")));
PAccountCombo - & gt; GetText ();
}
}
}
//OnCreate here has a problem, there has been no change, should not need to use a callback
LRESULT OnCreate (UINT uMsg, WPARAM WPARAM, LPARAM LPARAM, BOOL& BHandled)
{
LONG styleValue=https://bbs.csdn.net/topics/::GetWindowLong (* this, GWL_STYLE);
StyleValue & amp;=~ WS_CAPTION;
: : SetWindowLong (* this GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);

M_pm. Init (m_hWnd);
M_pm. AddPreMessageFilter (this);
CDialogBuilder builder;
CDialogBuilderCallbackEx cb.
CControlUI * pRoot=builder. The Create (_T (" Qtitle. XML "), (UINT) 0, & amp; Cb, & amp; M_pm);
ASSERT (pRoot & amp; & "Failed to parse the XML");
M_pm. AttachDialog (pRoot);
M_pm. AddNotifier (this);

The Init ();
return 0;
}


Public:
CPaintManagerUI m_pm;
Private:
CButtonUI * p_surebtn;

};

Int APIENTRY _tWinMain (HINSTANCE HINSTANCE, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{



CPaintManagerUI: : SetInstance (hInstance);

CDuiFrameWnd duiFrame;
DuiFrame. Create (NULL, _T (" DUIWnd "), the WS_VISIBLE | WS_POPUP, WS_EX_WINDOWEDGE);
DuiFrame. CenterWindow ();
DuiFrame. ShowModal ();

return 0;
}
o great god give directions, newcomers are meng, thank you thank you

CodePudding user response:

What need not declare m_pm, there was a m_paintmaneger can use directly

CodePudding user response:

reference 1st floor zhao3132453 response:
need not declare m_pm, what a m_paintmaneger can directly use the
statement m_pm is equivalent to m_paintmanager ah, and you said this is also need to declare
  • Related