| Ver tema anterior :: Ver tema siguiente |
| Autor |
Mensaje |
Esau1 Invitado
|
Publicado: Mie 19 Nov, 2003 1:09 am Asunto: ¿Alguien sabe como ajustar el texto a la derecha en un TEdi? |
|
|
Hola!!!
Alguien sabe cómo ajustar el contenido de un texto en el objeto TEdit en c++ builder 5 de derecha a izquierda como en una calculadora. Por ejemplo, cuando introducimos números a la calculadora de windows éste lo acomoda automáticamente de derecha a izquierda.
Si alguien sabe cómo hacer ésto por favor que me diga cómo hacerlo o si hay alguna función que haga esto.
Aún no soy experto en builder pero me gustaría aprender más sobre esta herramienta de programación. |
|
| Volver arriba |
|
 |
Owner Invitado
|
|
| Volver arriba |
|
 |
Cesar C. Salazar Gonzalez Master


Registrado: 01 Oct 2002Mensajes: 2155Ubicación: San Cristóbal de Las Casas, Chiapas
|
Publicado: Mie 19 Nov, 2003 7:57 am Asunto: |
|
|
Puedes usar la propiedad siguiente del TEdit, que te lo justifica a la derecha
| Código: |
Determines how the text in the edit component is aligned.
__property TAlignment Alignment = {read=GetAlignement, write=SetAlignment, default
=taLeftJustify};
Description
Use Alignment to indicate text alignment in the edit box. These are the possible values:
Value Meaning
taLeftJustify Align text on the left side in the edit control.
taCenter Center the text in the edit control.
taRightJustify Align text on the right side in the edit control.
|
ejemplo puede ser este...
| Código: |
Edit1->Alignment = taLeftJustify // izquierda
Edit1->Alignment = taCenter // centro
Edit1->Alignment = taRightJustify // Derecha
|
Sacado de la ayuda de builder..
espero haberte ayudado... _________________
 |
|
| Volver arriba |
|
 |
Fernando Diaz Master


Registrado: 18 Jul 2004Mensajes: 273Ubicación: Talavera de la Reina (Toledo)
|
Publicado: Lun 02 May, 2005 10:50 am Asunto: |
|
|
César losiento, pero no me pilla esa propiedad el Edit, que otra forma hay?? _________________ Los problemas mas dificiles tienen las soluciones mas sencillas
 |
|
| Volver arriba |
|
 |
Fernando Diaz Master


Registrado: 18 Jul 2004Mensajes: 273Ubicación: Talavera de la Reina (Toledo)
|
|
| Volver arriba |
|
 |
Cesar C. Salazar Gonzalez Master


Registrado: 01 Oct 2002Mensajes: 2155Ubicación: San Cristóbal de Las Casas, Chiapas
|
Publicado: Lun 02 May, 2005 4:08 pm Asunto: |
|
|
Algo medio extraño, pero puede funcionar asi.
en el archivo cpp, donde esta tu form, y en Creador del Form pon lo siguiente
| Código: | __fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
EditDerecha=new TEditDerecha(Form1);
EditDerecha->Name="MyEdit1";
EditDerecha->Parent=Form1;
EditDerecha->Left=10;
EditDerecha->Top=10;
EditDerecha->Text="derecha";
}
//-- |
y en el unit1.h, creamos una nueva clase, que derive de TEdit, de la siguiente manera
| Código: | //---------------------------------------------------------------------------
class TEditDerecha:public TEdit
{
public:
__fastcall TEditDerecha(Classes::TComponent* AOwner):TEdit(AOwner){};
protected:
void __fastcall CreateParams(TCreateParams &Params)
{
TEdit::CreateParams(Params);
Params.Style |=ES_RIGHT;
}
};
TEditDerecha *EditDerecha=NULL;
//---------------------------------------------------------------------------
class TForm1 : public TForm // aqui viene el form y todo lo demas... |
Espero te sirva
Saludos!! _________________
 |
|
| Volver arriba |
|
 |
|