🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Can reverse video in edit control be shut off?

#16207
From: user
Date: Mon, 26 May 2003 21:50
48 lines
2933 bytes
Bill Carson wrote:
>>The text in the edit control is being displayed in "reverse video"
>>because it is selected. You can clear the selection by sending the
>>EM_SETSEL message to the control with the starting point parameter,
>>wParam, set to -1.
>>
>>lResult = SendMessage(
>>           hWndControl, // handle to destination control
>>           EM_SETSEL,   // message ID
>>           (WPARAM) -1, // starting character position of selection
>>           (LPARAM) 0   // ending character position of selection
>>);
>>
> 
> 
> Since I couldn't figure out how to get a handle to a control in a
> dialog box, I used the following instead, but it didn't work:
> 
>         case WM_INITDIALOG:
>          SetWindowText(hwndDlg, szFileName);
>          SetDlgItemText(hwndDlg, 199, (LPCSTR) pConv);
>          SendDlgItemMessage(
>            hwndDlg, // handle of dialog box
>                199, // identifier of the control that receives message
>            EM_SETSEL,   // message ID
>            (WPARAM) -1, // starting character position of selection
>            (LPARAM) 0   // ending character position of selection
>          );
> 
> Thanks,
> 
> Bill
> 
> 

Whoops. Apparently the OS selects all the text in an edit control 
whenever it gives it focus, so your efforts in WM_INITDIALOG are futile. 
The trick seems to be to clear the selection *after* the OS has set it, 
which you may do in an EN_SETFOCUS notification handler.

   case WM_COMMAND:
     if (LOWORD(wparam) == 199)
     {
       if (HIWORD(wparam) == EN_SETFOCUS)
       {
         SendMessage(reinterpret_cast<HWND>(lparam), EM_SETSEL, -1, 0);
       }
     }
Technical Details
Message-ID: <3ED28C29.40106@domain.invalid>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!newsfeed.news2me.com!small1.nntp.aus1.giganews.com!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3ed13bd7@newsgroups.borland.com> <3ED14414.2040904@directnet.com> <3ed23788@newsgroups.borland.com> <3ED23C01.80906@domain.invalid> <3ed25e24@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,a52495bb3fc3f3b6
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-26 15:24:35 PST
Message-ID: <3ED28C29.40106@domain.invalid>
Date: Mon, 26 May 2003 17:50:33 -0400
From:  user@domain.invalid
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Can reverse video in edit control be shut off?
References: <3ed13bd7@newsgroups.borland.com> <3ED14414.2040904@directnet.com> <3ed23788@newsgroups.borland.com> <3ED23C01.80906@domain.invalid> <3ed25e24@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 141.151.183.248
X-Trace: newsgroups.borland.com 1053985848 141.151.183.248 (26 May 2003 14:50:48 -0700)
Lines: 49
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!newsfeed.news2me.com!small1.nntp.aus1.giganews.com!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail