CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 38

Thread: [RESOLVED] How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

  1. #16
    Join Date
    Oct 2019
    Posts
    82

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    Hi GCDEF i used the resource editor and set the border to false which resulted in loss of boundaries of box , i also set client edge as false from there but no effect. As told i want the second box in the image i pasted above

  2. #17
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,797

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    Quote Originally Posted by Beginner_MFC View Post
    Hi GCDEF i used the resource editor and set the border to false which resulted in loss of boundaries of box , i also set client edge as false from there but no effect. As told i want the second box in the image i pasted above
    Again. use Spy++ as I wrote you in the post#13
    Victor Nijegorodov

  3. #18
    Join Date
    Oct 2019
    Posts
    82

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    I used the below code for creating CEdit dynamically, code compiled but editbox is not visible on screen.
    Code:
    CEdit *tedit = new CEdit;
    tedit->CreateEx(WS_EX_CLIENTEDGE , L"Edit", L" ", ES_AUTHOSCROLL | WS_BORDER | WS_VISIBLE | WS_CHILD , CRect(15,150,30,20),this, IDC_EDIT);

  4. #19
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,797

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    Is the CRect(15,150,30,20) within the parent?
    Victor Nijegorodov

  5. #20
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,598

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    Quote Originally Posted by Beginner_MFC View Post
    I used the below code for creating CEdit dynamically, code compiled but editbox is not visible on screen.
    Code:
    CEdit *tedit = new CEdit;
    tedit->CreateEx(WS_EX_CLIENTEDGE , L"Edit", L" ", ES_AUTHOSCROLL | WS_BORDER | WS_VISIBLE | WS_CHILD , CRect(15,150,30,20),this, IDC_EDIT);
    Look at the order of parameters for the CRect constructor.

    WS_EX_CLIENTEDGE will give you the 3D look you don't want. I only mentioned CreateEx earlier because you were using WS_EX_CLIENTEDGE with Create.

  6. #21
    Join Date
    Oct 2019
    Posts
    82

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    Yes Victor it is within the parent

  7. #22
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,797

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    Quote Originally Posted by Beginner_MFC View Post
    Yes Victor it is within the parent
    How did you check it is "within the parent"? Did you call GetWindowRect for both the parent and child to be sure they somehow intersect?
    Or did you use some other way? Which one?
    Victor Nijegorodov

  8. #23
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,797

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    Quote Originally Posted by Beginner_MFC View Post
    I used the below code for creating CEdit dynamically, code compiled but editbox is not visible on screen.
    Code:
    CEdit *tedit = new CEdit;
    tedit->CreateEx(WS_EX_CLIENTEDGE , L"Edit", L" ", ES_AUTHOSCROLL | WS_BORDER | WS_VISIBLE | WS_CHILD , CRect(15,150,30,20),this, IDC_EDIT);
    BTW, did you check the CreateEx returned TRUE?
    Victor Nijegorodov

  9. #24
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,598

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    Quote Originally Posted by VictorN View Post
    BTW, did you check the CreateEx returned TRUE?
    It's not displaying because his CRect arguments are wrong. The bottom is higher than the top.

  10. #25
    Join Date
    Oct 2019
    Posts
    82

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    CreateEx is returning true..I have wrote this code inside OnInitDialog() function. Does any effect of it ..Any specific message handler to be used ?

  11. #26
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,797

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    Quote Originally Posted by Beginner_MFC View Post
    CreateEx is returning true..I have wrote this code inside OnInitDialog() function. Does any effect of it ..Any specific message handler to be used ?
    Have you read the GCDEF's post (#24)?
    Victor Nijegorodov

  12. #27
    Join Date
    Oct 2019
    Posts
    82

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    I read but getting no clue how to fix that.if i am able to see it anywhere on the dialog than atleast i will move it where i want .. within OnInitDialog() i wrote CRect temp; GetWindowRect(&temp); while debugging i got following values [ LT(108,1), RB(712,724)],[656 723]. So now accordingly please suggest any rough CRect() coordinates so that editbox get atleast visible

  13. #28
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,598

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    Quote Originally Posted by Beginner_MFC View Post
    I read but getting no clue how to fix that.if i am able to see it anywhere on the dialog than atleast i will move it where i want .. within OnInitDialog() i wrote CRect temp; GetWindowRect(&temp); while debugging i got following values [ LT(108,1), RB(712,724)],[656 723]. So now accordingly please suggest any rough CRect() coordinates so that editbox get atleast visible
    No clue how to fix it? Look at the parameters you need to pass in to a CRect constructor and see if the ones you're passing in make sense. You need to figure that one out yourself. I gave a good clue a few posts back.

  14. #29
    Join Date
    Oct 2019
    Posts
    82

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    Hitting my trials since last 1 day, but not able to see CEdit on Screen. Below is the code of .rc file
    [CODE]
    IDD_DIALOG_M 0,0,283,277
    STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    CAPTION "MYDIALOG"
    FONT 8,"TAHOMA"
    BEGIN
    PUSHBUTTON "OK" 15,251,37,15
    END
    [/ CODE]

    Below is the code in .cpp for constructor and OnInitDialog

    Code:
    MyCDialog::MyCDialog( MyClass *acct, CWnd* pParent):CDialog(MyCDialog::IDD,pParent)
    {
    m_acct = acct;
    }
    
    BOOL MyCDilaog::OninItDialog()
    {
    CDialog::OnInitDialog():
    
    m_edit = new CEdit; // CEdit *m_edit declared in .h
    m_edit->CreatEx(!WS_EX_CLIENTEDGE , L"EDIT",L" " ,WS_BORDER | WS_VISIBLE  | WS_CHILD,  CRect(40,120,40,30), this, IDC_EDIT);
    
    return TRUE;
    }
    Please help me out in passing correct values inside CRect so that box become atleast visible on screen

  15. #30
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,598

    Re: How to do flat style of CEdit (EDITTEXT) and CComboBox in CDialog

    Quote Originally Posted by Beginner_MFC View Post
    Hitting my trials since last 1 day, but not able to see CEdit on Screen. Below is the code of .rc file
    [CODE]
    IDD_DIALOG_M 0,0,283,277
    STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    CAPTION "MYDIALOG"
    FONT 8,"TAHOMA"
    BEGIN
    PUSHBUTTON "OK" 15,251,37,15
    END
    [/ CODE]

    Below is the code in .cpp for constructor and OnInitDialog

    Code:
    MyCDialog::MyCDialog( MyClass *acct, CWnd* pParent):CDialog(MyCDialog::IDD,pParent)
    {
    m_acct = acct;
    }
    
    BOOL MyCDilaog::OninItDialog()
    {
    CDialog::OnInitDialog():
    
    m_edit = new CEdit; // CEdit *m_edit declared in .h
    m_edit->CreatEx(!WS_EX_CLIENTEDGE , L"EDIT",L" " ,WS_BORDER | WS_VISIBLE  | WS_CHILD,  CRect(40,120,40,30), this, IDC_EDIT);
    
    return TRUE;
    }
    Please help me out in passing correct values inside CRect so that box become atleast visible on screen
    Let's start simple. What are the arguments the CRect constructor takes?

    FWIW, the resource editor is much easier than doing it this way

Page 2 of 3 FirstFirst 123 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)