Click here to Skip to main content
15,900,725 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Intilaisation Problem (colors, icons to the button) Pin
kiranin24-Aug-06 2:35
kiranin24-Aug-06 2:35 
QuestionRe: Intilaisation Problem (colors, icons to the button) Pin
prasad_som24-Aug-06 2:43
prasad_som24-Aug-06 2:43 
QuestionRe: Intilaisation Problem (colors, icons to the button) Pin
kiranin24-Aug-06 2:54
kiranin24-Aug-06 2:54 
AnswerRe: Intilaisation Problem (colors, icons to the button) Pin
Hamid_RT25-Aug-06 1:49
Hamid_RT25-Aug-06 1:49 
GeneralRe: Intilaisation Problem (colors, icons to the button) Pin
kiranin25-Aug-06 3:43
kiranin25-Aug-06 3:43 
GeneralRe: Intilaisation Problem (colors, icons to the button) Pin
Hamid_RT25-Aug-06 4:36
Hamid_RT25-Aug-06 4:36 
GeneralRe: Intilaisation Problem (colors, icons to the button) Pin
prasad_som24-Aug-06 3:04
prasad_som24-Aug-06 3:04 
QuestionProblem with CColorDlg. Pin
uday kiran janaswamy24-Aug-06 2:05
uday kiran janaswamy24-Aug-06 2:05 
hi all,

I have dynamically created a CEdit Control in the Dialog. When ever i Right Click in the EditBox i have to show popup a Menu. Then I select the FirstMenu Item from Menu must show a CColorDialog and choose a Color and store it in a COLORREF variable. This is done using TrackPopupMenu(...) when ever i Right Click in the Newly Created EditBox Dynamically.

after choosing the Color from the ColorDialog Box. That Color Must be Reflected in the Edit Box where ever i RightClicked.

//===========================================================================

void CExpDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
CClientDC *dc = new CClientDC(this);
ptr = new CEdit; //Create Dynamic Edit Control Here
ptr->Create(WS_VISIBLE|WS_CHILD|WS_BORDER|WS_TABSTOP|ES_AUTOHSCROLL,CRect (point.x,point.y,point.x +100, point.y +20),this,ctr++);// Dynamic Edit.

CDialog::OnLButtonDown(nFlags, point);
}


HBRUSH CExpDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
switch (nCtlColor)
{
case CTLCOLOR_EDIT: //For General EditBox. here i am bit confused
pDC->SetBkColor(c); // where c is COLORREf selected in ColorDialog
break;
}
return 0;
}

//This when ever i right Click on the newly Created EditBox Item.

void CExpDlg::OnParentNotify(UINT message, LPARAM lParam)
{
if(message == WM_RBUTTONDOWN)
{
CPoint pt(LOWORD(lParam),HIWORD(lParam));
PopupMenu (&pt);
}
}
//Populate the Menu Item
void CExpDlg::PopupMenu(CPoint* pt)
{
ClientToScreen (pt);
CMenu FloatingMenu;
FloatingMenu.LoadMenu(IDR_MENU1);
CMenu* pPopupMenu = FloatingMenu.GetSubMenu (0);
pPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt->x, pt->y, this);
}

//This is the Menu Item when the TrackPopUp is Shown.
void CExpDlg::OnObjetsOne()
{
CColorDialog dlg;
if(dlg.DoModal()== IDOK)
{
c = dlg.GetColor(); // c is the ColorRef of the ColorDialog.
}
}

Here the New color what i am choosing is not Reflected to the EditBox which i Created Dynamically.

please provide me a solution.
//===========================================================================



Uday kiran
QuestionRe: Problem with CColorDlg. Pin
prasad_som24-Aug-06 2:18
prasad_som24-Aug-06 2:18 
AnswerRe: Problem with CColorDlg. [modified] Pin
uday kiran janaswamy24-Aug-06 2:27
uday kiran janaswamy24-Aug-06 2:27 
GeneralRe: Problem with CColorDlg. [Modified] Pin
prasad_som24-Aug-06 2:36
prasad_som24-Aug-06 2:36 
GeneralRe: Problem with CColorDlg. Pin
uday kiran janaswamy24-Aug-06 2:37
uday kiran janaswamy24-Aug-06 2:37 
GeneralRe: Problem with CColorDlg. [modified] Pin
prasad_som24-Aug-06 2:41
prasad_som24-Aug-06 2:41 
GeneralRe: Problem with CColorDlg. [modified] Pin
uday kiran janaswamy24-Aug-06 3:13
uday kiran janaswamy24-Aug-06 3:13 
GeneralRe: Problem with CColorDlg. [modified] Pin
prasad_som24-Aug-06 3:43
prasad_som24-Aug-06 3:43 
GeneralRe: Problem with CColorDlg. Pin
uday kiran janaswamy24-Aug-06 19:05
uday kiran janaswamy24-Aug-06 19:05 
GeneralRe: Problem with CColorDlg. Pin
Hamid_RT25-Aug-06 1:44
Hamid_RT25-Aug-06 1:44 
QuestionUSB drive volume mount points cann't be backed up on the other system Pin
Zahid Younas24-Aug-06 1:58
Zahid Younas24-Aug-06 1:58 
QuestionBit Edit Control Pin
SzyKam24-Aug-06 1:57
SzyKam24-Aug-06 1:57 
AnswerRe: Bit Edit Control Pin
Cedric Moonen24-Aug-06 2:00
Cedric Moonen24-Aug-06 2:00 
AnswerRe: Bit Edit Control Pin
uday kiran janaswamy24-Aug-06 2:36
uday kiran janaswamy24-Aug-06 2:36 
QuestionWant to hide the windows start menu Pin
dinesh_IP24-Aug-06 1:34
dinesh_IP24-Aug-06 1:34 
AnswerRe: Want to hide the windows start menu Pin
toxcct24-Aug-06 1:56
toxcct24-Aug-06 1:56 
AnswerRe: Want to hide the windows start menu Pin
Hamid_RT24-Aug-06 2:02
Hamid_RT24-Aug-06 2:02 
GeneralRe: Want to hide the windows start menu Pin
toxcct24-Aug-06 2:07
toxcct24-Aug-06 2:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.