Board index » cppbuilder » Selecting all text in an edit box

Selecting all text in an edit box

When I tab between edit boxes the contents of the edit box are all
highlighted. (AutoSelect is set TRUE).
If I use the mouse to click into an edit box, it does not highlight all
text.
The only way I've managed it is to put the following in the OnEnter event
for the edit component:

    SelectNext(this->ActiveControl,true,true);
    SelectNext(this->ActiveControl,false,true);

There must be a more elegant solution than this??

Regards

 

Re:Selecting all text in an edit box


Use the edit control's SelectAll() method:

    void __fastcall TForm1::Edit1Enter(TObject *Sender)
    {
        Edit1->SelectAll();
    }

Gambit

Quote
"Neil Raffan" <n...@accsystems.co.uk> wrote in message

news:3bbe336e$1_2@dnews...
Quote
> The only way I've managed it is to put the following in the OnEnter event
> for the edit component:

>     SelectNext(this->ActiveControl,true,true);
>     SelectNext(this->ActiveControl,false,true);

> There must be a more elegant solution than this??

Re:Selecting all text in an edit box


Remy,

It doesn't work in the OnEnter event.
It does, however, work in the OnClick event.

Regards

Quote
"Remy Lebeau" <gambi...@gte.net> wrote in message news:3bbe40c7$1_1@dnews...
> Use the edit control's SelectAll() method:

>     void __fastcall TForm1::Edit1Enter(TObject *Sender)
>     {
>         Edit1->SelectAll();
>     }

> Gambit

Re:Selecting all text in an edit box


Then set AutoSelect property to true.

--

Milan Babuskov

Quote
> It doesn't work in the OnEnter event.
> It does, however, work in the OnClick event.

Re:Selecting all text in an edit box


Auto Select *is* true.

Quote
"Milan Babuskov" <mil...@Yugoslavia.EU.net> wrote in message

news:3bc2c5d2_1@dnews...
Quote
> Then set AutoSelect property to true.

> --

> Milan Babuskov

> > It doesn't work in the OnEnter event.
> > It does, however, work in the OnClick event.

Re:Selecting all text in an edit box


I'm sorry, I thought you may have set it to false while you were trying to
make it work.
--

Milan Babuskov

Other Threads