🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Multi line edit control foe ListView

#7346
From: Sam S. Firouz
Date: Wed, 09 Feb 2005 15:01
84 lines
3976 bytes
Well that took care of the exception. (it was left there by mistake). Now my 
code looks like this:
bool __fastcall TListViewEx::CanEdit(TListItem* Item)
{
 bool RetVal(true);

   if (0 < ColumnToEdit)  // ignore the Caption, let it do its default 
handling
   {
    if (NULL != FOnSubItemEditing)
       FOnSubItemEditing(this, Item, ColumnToEdit, RetVal);
      if (RetVal)
      {
         HWND hEdit = ListView_GetEditControl(Handle);   // get the inline 
editor's handle

         if (NULL != hEdit)
         {
            TRect R;

            if(GetEditRect(Item, ColumnToEdit, R)) // determine the 
dimensions of the subitem being edited
            {
               MYWNDPROC TempEditProc;
               LONG TempStyle;

               // move the inline editor over the subitem
               MoveWindow(hEdit, R.Left, R.Top - 2, R.Width(), R.Height() + 
24, TRUE);

               // update the inline editor's text with the subitem's text 
rather than the Caption
               SetWindowText(hEdit, 
Item->SubItems->Strings[ColumnToEdit -1 ].c_str());

               // subclass the inline editor so we can catch its movements
               TempEditProc = (MYWNDPROC)GetWindowLong(hEdit, GWL_WNDPROC);
               if (TempEditProc != (MYWNDPROC)MyEditWndProc)
               {
                  // Get The Current Style;
                  TempStyle = GetWindowLong(hEdit, GWL_STYLE) | 
ES_MULTILINE;
                  TempStyle &= (~WS_HSCROLL & ~ES_AUTOVSCROLL);
                  SetWindowLong(hEdit, GWL_STYLE, TempStyle);
                  SendMessage (hEdit, CM_RECREATEWND, 0, 0);

                  OldEditProc = TempEditProc;
                  SetWindowLong(hEdit, GWL_WNDPROC, (LONG)MyEditWndProc);
               }
            }
         }
      }
   }
   else if (NULL != OnEditing)
    OnEditing(this, Item, RetVal);
   return RetVal;
}
But it still does not accept multi line text. You cannot even paste multi 
line text into it.
Is there a way to replace the default edit control with our own? Foe example 
create our own TMemo and tell the list view to use that one insted?

Thank You
Sam
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:42092ab0@newsgroups.borland.com...
>
> "Sam S. Firouz" <sfirouz@Hotmail.com> wrote in message
> news:42091d9a$1@newsgroups.borland.com...
>
>>          HWND hEdit = ListView_GetEditControl(Handle);
>>          SetWindowLong(hEdit, GWL_STYLE, ES_MULTILINE);
>
> You are wiping out all of the edit window's current styles.  You need to 
> use
> GetWindowLong() in order to preserve existing styles:
>
>    SetWindowLong(hEdit, GWL_STYLE, GetWindowLong(hEdit, GWL_STYLE) |
> ES_MULTILINE);
>
>
> Gambit
>
> 
Technical Details
Message-ID: <420a24bf$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!ltu.se!luth.se!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4208d83b$1@newsgroups.borland.com> <420900fb$1@newsgroups.borland.com> <42091d9a$1@newsgroups.borland.com> <42092ab0@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,1917315e7e13daf3
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Sam S. Firouz" <sfirouz@Hotmail.com>
From: "Sam S. Firouz" <sfirouz@Hotmail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4208d83b$1@newsgroups.borland.com> <420900fb$1@newsgroups.borland.com> <42091d9a$1@newsgroups.borland.com> <42092ab0@newsgroups.borland.com>
Subject: Re: Multi line edit control foe ListView
Date: Wed, 9 Feb 2005 10:01:21 -0500
Lines: 86
Organization: F. C. C.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 132.250.186.165
Message-ID: <420a24bf$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1107961023 132.250.186.165 (9 Feb 2005 06:57:03 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!ltu.se!luth.se!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail