CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    69

    RichEdit Control not show text

    Hi,

    I'm triying to show a CString in RichEditControl with SetWindowsText, but when the dialog appear only show the container in white, but not show the text. What happen?

    This is the code of my function:

    Code:
    void CDlgDescriptivos::DescUnivariantesMostrar(void)
    {
    	CString aux;
    	CString cadena;
    	CTime fecha;
    	CString dato;
    	double *d;
    	int t,k=0,i;
    	CDatos* p = (CDatos*)Variables.GetAt (0);
    	
    	t = p->Tam ;
    	
    	
    	int Tam,tsin;
    	Tam = p->Tam;
    	tsin = p->Tam;
    	double total_acum=0;
    	int cont=0,cont2=0;
    
    	informe.Nombre = _T("DescUniv") + p->Nombre ;
    	informe.Descripcion = _T("Análisis Descriptivo Univariante de la variable ") + p->Nombre;
    	informe.nPerdidos = p->Tam -t ;
    	informe.nTamano = 22;
    	informe.VarsImplicadas = p->Nombre ;
    	fecha = CTime::GetCurrentTime ();
    	dato = fecha.Format ("%d/%m/%y");
    	informe.Fecha = dato;
    	dato = fecha.Format ("%H:%M");
    	informe.Hora = dato;
    	informe.Tipo = 900;
    	informe.Tam = 22;
    	informe.Datos = new CString [22];
    
    	if(p->Tipo==0 && p->Escala==0 )
    	{
    		d = QuitarAusentes (p->Datos , t, p->Ausente );
    	
    	
    		cadena.Format( _T("\n\n \t\tMEDIDAS DE POSICIÓN\n\n"));
    		informe.Datos [0] = cadena;
    		if (Moda (d, t)!= d[0])
    		{
    			cadena.Format(_T("\n\tModa no única: Min es %f"),d[0]);
    	
    			informe.Datos [1] = cadena;
    		}
    		else
    		{
    			cadena.Format(_T("\n\tModa:\t\t%f"),PRESICION, Moda (d, t));
    	
    			informe.Datos [1] = cadena;
    		}
    		cadena.Format (_T("\n\tMediana:\t\t%.*f"), PRESICION, Mediana (d, t));
    		informe.Datos [2] = cadena;
    		cadena.Format (_T("\n\tMedia:\t\t%.*f"), PRESICION, Media (d, t));
    		informe.Datos [3] = cadena;
    		cadena.Format (_T("\n\tMínimo:\t\t%.*f"), PRESICION, Minimo (d, t));
    		informe.Datos [4] = cadena;
    		cadena.Format (_T("\n\tMáximo:\t\t%.*f"), PRESICION, Maximo (d, t));
    		informe.Datos [5] = cadena;
    		cadena.Format (_T("\n\tCuartil1:\t\t%.*f"), PRESICION, Cuartil1(d, t));
    		informe.Datos [6] = cadena;
    		cadena.Format (_T("\n\tCuartil2:\t\t%.*f"), PRESICION, Cuartil2 (d, t));
    		informe.Datos [7] = cadena;
    		cadena.Format (_T("\n\tCuartil3:\t\t%.*f\n"), PRESICION, Cuartil3(d, t));
    		informe.Datos [8] = cadena;
    		cadena.Format( _T("\n\t\tMEDIDAS DE DISPERSIÓN\n\n"));
    		informe.Datos [9] = cadena;
    		cadena.Format (_T("\n\tRango:\t\t\t%.*f"), PRESICION, Rango (d, t));
    		informe.Datos [10] = cadena;
    		cadena.Format (_T("\n\tRango Intercuartílico:\t%.*f"), PRESICION, RInter (d, t));
    		informe.Datos [11] = cadena;
    		cadena.Format (_T("\n\tSemi Rango Intercuartílico:\t%.*f"), PRESICION, SRInter (d, t));
    		informe.Datos [12] = cadena;
    		cadena.Format (_T("\n\tVarianza:\t\t\t%.*f"), PRESICION, Varianza (d, t));
    		informe.Datos [13] = cadena;
    		cadena.Format (_T("\n\tCuasi Varianza:\t\t%.*f"), PRESICION, CVarianza (d, t));
    		informe.Datos [14] = cadena;
    		cadena.Format (_T("\n\tDesviación Típica:\t\t%.*f"), PRESICION, DesvTip (d, t));
    		informe.Datos [15] = cadena;
    		cadena.Format (_T("\n\tCuasi Desviación Típica:\t%.*f"), PRESICION, CDesvTip (d, t));
    		informe.Datos [16] = cadena;
    		cadena.Format (_T("\n\tCoeficiente de Variación:\t%.*f"), PRESICION, CoefVar (d, t));
    		informe.Datos [17] = cadena;
    		cadena.Format (_T("\n\tError Estándar:\t\t%.*f\n"), PRESICION, ErrorStandar (d, t));
    		informe.Datos [18] = cadena;
    		cadena.Format(_T("\n\t\tMEDIDAS DE ASIMETRÍA Y DEFORMACIÓN\n\n"));
    		informe.Datos [19] = cadena;
    		cadena.Format (_T("\n\tCoeficiente de Asimetría:\t%.*f"), PRESICION, CoefAsim (d, t));
    		informe.Datos [20] = cadena;
    		cadena.Format (_T("\n\tCoeficiente de Kurtosis:\t%.*f"), PRESICION, Kurtosis (d, t));
    		informe.Datos [21] = cadena;
    		
    	}
    	
    	
    	if(p->Tipo==0 && p->Escala==1 )
    	{
    	
    		d = QuitarAusentes (p->Datos , t, p->Ausente );
    	
    		cadena.Format(_T( "\n\n \t\tMEDIDAS DE POSICIÓN\n\n"));
    		informe.Datos [0] = cadena;
    		if (Moda (d, t)!= d[0])
    		{
    			cadena.Format(_T("\n\tModa no única: Min es %f"),d[0]);
    	
    			informe.Datos [1] = cadena;
    		}
    		else
    		{
    			cadena.Format(_T("\n\tModa:\t\t%f"),Moda(d,t));
    	
    			informe.Datos [1] = cadena;
    		}
    		cadena.Format (_T("\n\tMediana:\t\t%.*f"), PRESICION, Mediana (d, t));
    		informe.Datos [2] = cadena;
    	
    		cadena.Format (_T("\n\tCuartil1:\t\t%.*f"), PRESICION, Cuartil1(d, t));
    		informe.Datos [3] = cadena;
    		cadena.Format (_T("\n\tCuartil2:\t\t%.*f"), PRESICION, Cuartil2 (d, t));
    		informe.Datos [4] = cadena;
    		cadena.Format (_T("\n\tCuartil3:\t\t%.*f\n"), PRESICION, Cuartil3(d, t));
    		informe.Datos [5] = cadena;
    	}
    
    	if(p->Tipo==0 && p->Escala==2 )
    	{
    		d = QuitarAusentes (p->Datos , t, p->Ausente );	
    	
    	
    		cadena.Format(_T( "\n\n \t\tMEDIDAS DE POSICIÓN\n\n"));
    		informe.Datos [0] = cadena;
    
    		if (Moda (d, t)!= d[0])
    		{
    			cadena.Format(_T("\n\tModa no única: Min es %f"),d[0]);
    	
    			informe.Datos [1] = cadena;
    	
    		}
    		
    		else
    		{
    			cadena.Format(_T("\n\tModa:\t%f"),Moda(d,t));
    	
    			informe.Datos [1] = cadena;
    	
    		}
    	
    		
    	}
    	
    	else if(p->Tipo==1)
    	{
    		int rep=0,k;
    		int tamano=0;
    		CString *nuevo,cad;
    		double *vector;
    		vector= new double[t];
    		nuevo=new CString [t];
    	
    		for(i=0;i<t;i++)
    		{
    			nuevo[i]=p->Dat_Txt[i];
    		}
    
    		for(i=0;i<t;i++)
    		{
    		vector[i]=atoi(CT2CA(nuevo[i]));
    		}
    	
    	
    		//d = QuitarAusentes (vector , t, p->Ausente );	
    	
    		
    		cadena.Format( _T("\n\n \t\tMEDIDAS DE POSICI&#211;N\n\n"));
    		informe.Datos [0] = cadena;
    
    		if (Moda (vector, t)!= vector[0])
    		{
    			cadena.Format( _T("\n\tModa no &#250;nica: Min es %f"),vector[0]);
    	
    			informe.Datos [1] = cadena;
    	
    		}
    		else
    		{
    			cadena.Format( _T("\n\tModa:\t%f"),Moda(vector,t));
    	
    			informe.Datos [1] = cadena;
    	
    	
    		}
    		
    	}
    	
    	cadena=  _T("\n\t") + informe.Descripcion +  _T("\n\n");
    	cadena +=  _T("\tFecha creaci&#243;n:\t") + informe.Fecha +  _T("\n");
    	cadena +=  _T("\tHora creaci&#243;n:\t") + informe.Hora +  _T("\n");
    	aux.Format ( _T("%d"), informe.nTamano );
    	cadena +=  _T("\tTama&#241;o Muestra:\t") + aux+  _T("\n");
    	aux.Format ( _T("%d"), informe.nPerdidos );
    	cadena +=  _T("\tDatos Perdidos:\t") + aux +  _T("\n");
    	cadena +=  _T("\tVariable:\t\t") + informe.VarsImplicadas ;
    	k=0;
    		for (i=0;i<informe.nTamano;i++)
    		{
    		cadena +=  _T("\t") + informe.Datos[k];
    			k++;				
    		}
    		
      
       m_rich.SetWindowText (cadena);	
    	
    }
    Last edited by a343; August 29th, 2011 at 11:08 AM.

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: RichEdit Control not show text

    SetWindowText sets the text of a CWnd. A RichEditControl is much more and has its own functions to set the text. Check the help on a RichEditControl.

  3. #3
    Join Date
    Aug 2011
    Posts
    69

    Re: RichEdit Control not show text

    Quote Originally Posted by Skizmo View Post
    SetWindowText sets the text of a CWnd. A RichEditControl is much more and has its own functions to set the text. Check the help on a RichEditControl.
    Could you give me any web, plz? Do you know which is the function to show the text?

  4. #4
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: RichEdit Control not show text


  5. #5
    Join Date
    Aug 2011
    Posts
    69

    Re: RichEdit Control not show text

    I'm sorry, I'm so silly, but I've looked all day and I didn't find the function to show the text in richEdit control 2.0. Please, Could you give the name or the web?
    I'm learning to program in visual c++

  6. #6
    Join Date
    May 2006
    Location
    Dresden, Germany
    Posts
    458

    Re: RichEdit Control not show text

    Hi,

    Quote Originally Posted by a343 View Post
    I'm sorry, I'm so silly, but I've looked all day and I didn't find the function to show the text in richEdit control 2.0. Please, Could you give the name or the web?
    I'm learning to program in visual c++
    "Learning to program in visual c++" is much harder then learning how to use a web search engine (just like google like Skizmo proposed).

    Why should we google that for you? In Post #2 Skizmo provided you the right idea and suggested to google for the details. Please be so kind and google that by your own. It seems to me that you don't want to "learn to program in visual c++" : What you want to do is : Getting finished working code from CodeGuru ...

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured