Уже уходишь?

А у нас еще много всякого интересного!

А ты уже пробовал наш СУПЕР-поиск на форуме ?

Находит все!

Или напиши админу и он тебе поможет обязательно!

+

Книги по Delphi / Delphi Books

emailx45

Профи
Staff member
Moderator
TEdit accepting only FLOAT values or NOT and some keys from User (NUMBERs, DOT, COMMA, ENTER, BACKSPACE, ESC, etc..)
NOTE: NOT PERFECT OK! :)

Here my simple TEDIT sample for this, of course, is possible using a code more xpert like create a class to automatize all process, or same, use new functions/procedure on RAD Studio 10.3.3 Rio.
 
Last edited:

scroogeby

Проверенный
Here my simple TEDIT sample for this, of course, is possible using a code more xpert like create a class to automatize all process, or same, use new functions/procedure on RAD Studio 10.3.3 Rio.
This is a bad way:
1. input "-123" and then to the first position "4" - you will get "4-123"
2. you cannot use ctrl+a or ctrl+c
3. and most importantly. from clipboard you can paste any text
 

scroogeby

Проверенный
Essential Delphi New Edition, the First Chapter
©Marco Cantu
As I mentioned two weeks ago, in the occasion of Delphi's 25th anniversary I decided to go back to the roots and publish a book introducing the Delphi IDE based on content of my old Mastering Delphi volumes with additional material covering more recent changes. The ebook is fully edited for version 10.3 of Delphi.
Notice that the focus in not on developers with many years of experience with Delphi, but mostly new and less experienced users. But I'm sure that even those with more confidence and knowledge will find features here and there that they are not aware of.
At this time I've completed the initial review of the first chapter and just started the second chapter:
Chapter 1: A Form is a Window
Chapter 2: Highlights of the Delphi IDE

 

emailx45

Профи
Staff member
Moderator
New C++Builder YouTube video series - "Rapid C++ Development: Combining C++Builder with MSVC++"
David I - 9/3/2020
 
Last edited:

emailx45

Профи
Staff member
Moderator
Here my sample to works with Class Helper to Strings to divide it in "before" and "after" Delimiter char! - very easy!

Code:
unit uMainForm;

interface

uses
  Winapi.Windows,
  Winapi.Messages,
  System.SysUtils,
  System.Variants,
  System.Classes,
  Vcl.Graphics,
  Vcl.Controls,
  Vcl.Forms,
  Vcl.Dialogs,
  Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    btnUsinSPLIT_function: TButton;
    ListBox1: TListBox;
    btnUsingListBox: TButton;
    ListBox2: TListBox;
    Memo1: TMemo;
    btnMyNewSplitStrings: TButton;
    procedure btnUsinSPLIT_functionClick(Sender: TObject);
    procedure btnUsingListBoxClick(Sender: TObject);
    procedure btnMyNewSplitStringsClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btnUsinSPLIT_functionClick(Sender: TObject);
var
  lMyArraySpplited: TArray<string>;
  lMyRegKey       : string;
  lNewRegKey      : string;
  i               : Integer;
  lLastDelimiter  : integer;
begin
  memo1.Lines.Clear;
  //
  // if lMyRegKey = ''  or '\'  -> it's necessary verify too!
  // But DONT problem if lLastDelimiter <= 0
  // on the end, your "string" resulted can be EMPTY!
  // None exception will be raised!
  //
  lMyRegKey := 'part1\part2\part3\value';
  //
  lMyArraySpplited := lMyRegKey.Split(['\']);
  //
  lLastDelimiter := lMyRegKey.LastDelimiter('\') + 1; // +1 here or below (Rigth substring)
  //
  memo1.Lines.Add('SubString Left  = ' + lMyRegKey.Substring(-lLastDelimiter, lLastDelimiter));
  memo1.Lines.Add('SubString Right = ' + lMyRegKey.Substring(lLastDelimiter));
  //
  memo1.Lines.Add('LastDelimiter = ' + lMyRegKey.LastDelimiter('\').ToString);
  //
  memo1.Lines.Add('');
  //
  lNewRegKey := lMyRegKey.Join('\', lMyArraySpplited, 0, 2); // "part1\part2"
  //
  memo1.Lines.Add('Join 0 to 2 = ' + lNewRegKey);
  //
  lNewRegKey := lMyRegKey.Join('\', lMyArraySpplited, 3, 4); // "value"
  //
  memo1.Lines.Add('Join 3 to 4 = ' + lNewRegKey);
  //
  memo1.Lines.Add('');
  //
  for i := 0 to high(lMyArraySpplited) do
  begin
    if lMyArraySpplited[i] <> '' then
      memo1.Lines.Add(lMyArraySpplited[i]);
  end;
end;

procedure TForm1.btnMyNewSplitStringsClick(Sender: TObject);
var
  lMyRegKey       : string;
  lMyArraySpplited: TArray<string>;
begin
  Memo1.Lines.Clear;
  //
  lMyRegKey := 'part1\part2\part3\value';
  //
  // start from "1" and ending on "3" chars!
  // using "\" like my "Delimiter" to split my string!
  //
  lMyArraySpplited := lMyRegKey.Split(['\'], '1', '3', Length(lMyRegKey));
  //
  Memo1.Lines.Add('How many items SPLITTED = ' + Length(lMyArraySpplited).ToString);
  Memo1.Lines.Add('');
  Memo1.Lines.Add('my items:');
  //
  Memo1.Lines.AddStrings(lMyArraySpplited); // working with my items splitted (my array)
end;

procedure TForm1.btnUsingListBoxClick(Sender: TObject);
var
  lMyRegKey: string;
begin
  lMyRegKey := 'part1\part2\part3\value';
  //
  ListBox1.Items.Delimiter     := '\';
  ListBox1.Items.DelimitedText := lMyRegKey;
  //
  ListBox2.Items.Clear;
  ListBox2.Items.Add(ListBox1.Items[3]);
  //
  // another ways can help too, when using a "List"
  //
  // ListBox1.Items.IndexOf('first position to start')
  // ListBox1.Items.IndexOf('last position to end')
  // ShowMessage(ListBox1.Items.KeyNames[2]);
end;

end.
 
Last edited:

emailx45

Профи
Staff member
Moderator

emailx45

Профи
Staff member
Moderator
Last edited:

emailx45

Профи
Staff member
Moderator
Quick Tip: Fixing “Could not convert variant of type (Null) into type…”
thansk to CodeSmithing

...I often use the XML Data Binding wizard in Delphi. However, it doesn’t seem to have been given a lot of attention from Borland/Inprise/Borland/CodeGear/Embarcadero/Idera. And unfortunately, out of the box what it generates is often error prone, apparently not supporting optional elements/attributes.

 
Top