1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Label problem

Discussion in 'MFC' started by answerme, Jan 27, 2010.

  1. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    Hi all
    I am getting a error in creating a LABEL.I need to display different label at different positions
    for the first time iam getting it perfectly alright.i.e. when iam placing a symbol in window its coming perfectly alright.But when Iam placing another symbol in window its getting hanged in Label->Create() function. Am I missing something.
    Code:
    if(td.L_Type==ENT_LAND)
    	{
    	ConvertLonLatToXY(td.L_Latitude,td.L_Longitude);// To get X,Y cordinates
    	Label->Create(td.LandID, WS_OVERLAPPED|WS_CHILD|WS_DLGFRAME|WS_VISIBLE, 
            CRect(lx+10,ly,lx+55,ly+20), this, 0x188); // THIS IS WHERE SYSTEM GETS HANGED
                                                         //lx,ly value are correct it is giving different x & y value
    	}
    
     
  2. Gene Poole

    Gene Poole New Member

    Joined:
    Nov 10, 2009
    Messages:
    93
    Likes Received:
    5
    Trophy Points:
    0
    What is "Label"? Where are lx and ly coming from? What is td.LandID?
     
  3. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    Lable is
    CStatic *Label = new CStatic;


    lx & ly
    Iam calling this function ConvertLonLatToXY(td.L_Latitude,td.L_Longitude) which is having 2 parameters i.e.strucutre in td latitude & longtitude ,with this 2 parameters i will get X & Y cordinates ie(X=lx & Y=ly)

    td.LandID is string which i want to display
     
  4. Gene Poole

    Gene Poole New Member

    Joined:
    Nov 10, 2009
    Messages:
    93
    Likes Received:
    5
    Trophy Points:
    0
    Are you trying to create your CStatic more than once? Once it is created, you can change it's text by calling the SetWindowText() member function or you can move it to a new rectangle using the MoveWindow() member function. If you try to call Create on an object that is already created, it will fail.
     

Share This Page