Topic: Поле ввода

Добрый день!
Подскажите, как сделать так, чтобы при наборе текста в поле все начиналось с заглавной буквы?
Пробовал использовать маску ввода >L<, но как я понял, здесь жестко указывается количество символов. А мне необходимо вводить текст неограниченного по символам.
Спасибо!

Re: Поле ввода

Hi,
The easiest way is probably to use the 'namecase' command (see attached).
The only slight disadvantage to this is that it doesn't work interactively (in other words, as you type).
Derek.

Post's attachments

Attachment icon namecase.zip 442.95 kb, 41 downloads since 2023-12-28 

Re: Поле ввода

..... and here's a version that works interactively (ie as you type).
Regards,
Derek.

Post's attachments

Attachment icon namecase2.zip 442.63 kb, 49 downloads since 2023-12-28 

Re: Поле ввода

Hello Vickus, Hello Derek

You also have this code, but less pretty than Derek's :

procedure Form1_Edit1_OnChange (Sender: TObject);
begin
     if length(form1.edit1.text) = 1 then form1.edit1.text := namecase(form1.edit1.text);
        form1.edit1.selstart := length(form1.edit1.text);
end;

JB

Re: Поле ввода

Oops, I made a mistake in my copy and paste. This is what I wanted to copy:

procedure Form1_Edit1_OnExit (Sender: string);
begin
    Form1.Edit1.Text[1] := UpperCase(Form1.Edit1.Text[1]);
end;

Sorry Derek !

JB

Re: Поле ввода

Salut Jean,
Ça va ?
As usual, it's good that MVD gives us options:
1 - 'namecase' capitalises every single word in the whole edit field.
2 - 'uppercase(form1.edit1.tex[1]) capitalises just the first word in the whole edit field.
It's all depends on what Vickus needs his application to do.
Bonne année,
Derek.

Re: Поле ввода

Hello Derek

Hello Derek,
You're right, any (or all) of the suggestions may suit Vickus's needs.
It is the strength of MVD to allow this.
Best wishes to you and your family for 2024.
Same for all MVD users.
J.B.