🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17140

How to get assuring value of SelStart

#17140
From: Sky
Date: Mon, 07 Apr 2003 15:38
29 lines
1959 bytes
Hi all, I have a strange question,
the following function has been used.
void __fastcall TMainForm::Input_Symbol(AnsiString szSymbol)
{
    if (szSymbol.IsEmpty()) return;
    if (!ActiveControl->ClassNameIs("TEdit")) return;

    TEdit *edit = dynamic_cast<TEdit *>(ActiveControl);
    if (edit != NULL)
    {
        int t = edit->SelStart;
        AnsiString szText = edit->Text;
        szText.Insert(szSymbol, t + 1);
        edit->Text = szText;
        edit->SelStart = t + szSymbol.Length();
    }
}
Input_Symbol() has been used in my two project,
but one is correct and another is incorrect.
it always insert the symbol in front of cursor.
(some multi-byte characters has been used in TEdit)
the multi-byte character has been treated as one character in one project,
but in another project it has been treated as two character.
Does anyone can tell me what happened. How can i insert the appointed
symbol into cursor if there is multi-byte characters and standard character
farraginous.
Any hint?
TIA
Sky.
Technical Details
Message-ID: <3e919b72$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,e296741773c2fdfb,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-07 08:43:24 PST
Reply-To: "Sky" <akeehuang@163.net>
From: "Sky" <akeehuang@163.net>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: How to get assuring value of SelStart
Date: Mon, 7 Apr 2003 23:38:16 +0800
Lines: 31
Organization: CK
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 220.113.162.139
Message-ID: <3e919b72$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1049729906 220.113.162.139 (7 Apr 2003 08:38:26 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail