From Clomosy Docs

No edit summary
No edit summary
Line 53: Line 53:


'''Example:'''<br>
'''Example:'''<br>
:'''Base Syntax'''
'''var'''
MyForm:TclForm;
testEdit : TclEdit;<br>
'''begin'''
MyForm := TclForm.Create(Self);
testEdit:= MyForm.AddNewEdit(MyForm,'testEdit','Write something');
testEdit.TextSettings.Font.Size:=70;
testEdit.Align := alTop;
testEdit.Margins.Top:= 10;
testEdit.Height := 50;
testEdit.Width := 150;<br>
MyForm.Run;<br>
'''end;'''


:'''TRObject Syntax'''
:'''TRObject Syntax'''
Line 85: Line 71:
   
   
  }
  }
:'''Base Syntax'''
'''var'''
MyForm:TclForm;
testEdit : TclEdit;<br>
'''begin'''
MyForm := TclForm.Create(Self);
testEdit:= MyForm.AddNewEdit(MyForm,'testEdit','Write something');
testEdit.TextSettings.Font.Size:=70;
testEdit.Align := alTop;
testEdit.Margins.Top:= 10;
testEdit.Height := 50;
testEdit.Width := 150;<br>
MyForm.Run;<br>
'''end;'''
'''Output:'''<br>
'''Output:'''<br>
[[File:Edit.png|frameless|450px]]
[[File:Edit.png|frameless|450px]]

Revision as of 11:49, 22 August 2024

You can add text input field with "TclEdit". Let's see how it is defined.

AddNewEdit(TComponent, xName, xPromptText)

TComponent : The parent object of the defined component must be specified.

xName : The name of the defined TclEdit object must be written.

xPromptText : A hint or message to be displayed when the Text property is empty.


Feature Use of Definition
TclEdit testEdit : TclEdit; A variable belonging to the TclEdit class is created.
AddNewEdit testEdit = MyForm.AddNewEdit(MyForm,'testEdit','Test Edit Message'); A new Edit component is added to the form.
Width testEdit.Width = 150; Allows adjusting the width of the edit component.
Height testEdit.Height = 50; Allows adjusting the height of the edit component.
Align testEdit.Align = alTop; With the Align parameter, you can specify where you want our component to be aligned in the form. This parameter has multiple positioning properties. See the page to learn about these features.
Margins testEdit.Margins.Left= 100; // Right, Top, Bottom With the Margins parameter, you can give margins at any scale from the right, left, bottom, top.
TclEditMargins.png
StyledSettings testEdit.StyledSettings = ssFamily; You may want to change the appearance of the text on the label. In order to make these changes, it is necessary to activate the feature.
Size testEdit.TextSettings.Font.Size = 20; It is used to adjust the text size.
FontColor testEdit.TextSettings.FontColor = clAlphaColor.clHexToColor('#8a067c'); It is used to set the text color.
HorzAlign testEdit.TextSettings.HorzAlign = 1; The property controls the horizontal alignment of text. The possible values for HorzAlign are:
  • 0: Aligns the text to the center.
  • 1: Aligns the text to the left.
  • 2: Aligns the text to the right.
VertAlign testEdit.TextSettings.VertAlign = 1; The property controls the vertical alignment of text. The possible values for VertAlign are:
  • 0: Aligns the text to the center.
  • 1: Aligns the text to the top.
  • 2: Aligns the text to the bottom.
clTypeOfField testEdit.clTypeOfField = taFloat; (taString) When you click Edit, you can type all the characters (such as numbers, symbols, letters) you want in a text. You can restrict the characters you can write in the text. You can do this with the "clTypeOfField" command. You can define this command as "taFloat - taString".

taFloat; Only numbers and comma characters can be written. taString; All characters can be written. (numbers, symbols, letters)

ReadOnly testEdit.ReadOnly = True; It can be used if you want to prevent writing on the edit component.
Password testEdit.Password = False; It is used to hide the text entered by the user.
MaxLength testEdit.MaxLength = 5; To allow the user to restrict the character input for an edit component, you can use the MaxLength property. In the example, only 5 characters can be entered into the component.


Example:

TRObject Syntax
var
MyForm:TclForm;
testEdit : TclEdit;

{
MyForm = TclForm.Create(Self);
testEdit= MyForm.AddNewEdit(MyForm,'testEdit','Write something');
testEdit.TextSettings.Font.Size=70;
testEdit.Align = alTop;
testEdit.Margins.Top= 10; 
testEdit.Height = 50;
testEdit.Width = 150;

MyForm.Run;

}
Base Syntax
var
MyForm:TclForm;
testEdit : TclEdit;
begin MyForm := TclForm.Create(Self); testEdit:= MyForm.AddNewEdit(MyForm,'testEdit','Write something'); testEdit.TextSettings.Font.Size:=70; testEdit.Align := alTop; testEdit.Margins.Top:= 10; testEdit.Height := 50; testEdit.Width := 150;
MyForm.Run;
end;

Output:
Edit.png