Hello out there,
lang: csharp
topic: ListBox in RichTextBox / sql / db / editors

i am developing an sqlclientshellsystem, that makes it possible to
connect to various sqlservers ( ms sqlserver, oracle, db2, ... ).
Basic functionality is completed.
Now i want to implement wordcompletion for different things:
for example, if a user types in a tablename in order to specifiy the
columns,
i want to suggest the columns to him in form of a listbox popping up
beneath the tablename. ( like it is known in many IDEs (
Codecompletion or Intellisense ).

I know that i have to maintain keword database, schema information and
a like.

The problem is, how do i put a listbox into a textbox ??
i tried to TextBox.Controls.Add( ListBox ), but it doesn't have the
wanted effect.

Any hints ? ( I'm relatively new to .NET and haven't studied the
ComponentModel yet, but perhaps you might tell me how i can accomplish
my task )

Greetings and thanks in advance.

Ole Viaud-Murat

Re: ListBox within TextBox / CodeCompletion by Uriel

Uriel
Wed Aug 20 09:30:02 CDT 2003

Hi, Ole!

Check the following article. I think you'll find it very enlighting:

http://www.codeproject.com/csharp/csdoesshell4.asp

Uriel

"Ole" <oviaudmurat@web.de> wrote in message
news:c640408c.0308200453.6dd98f10@posting.google.com...
> Hello out there,
> lang: csharp
> topic: ListBox in RichTextBox / sql / db / editors
>
> i am developing an sqlclientshellsystem, that makes it possible to
> connect to various sqlservers ( ms sqlserver, oracle, db2, ... ).
> Basic functionality is completed.
> Now i want to implement wordcompletion for different things:
> for example, if a user types in a tablename in order to specifiy the
> columns,
> i want to suggest the columns to him in form of a listbox popping up
> beneath the tablename. ( like it is known in many IDEs (
> Codecompletion or Intellisense ).
>
> I know that i have to maintain keword database, schema information and
> a like.
>
> The problem is, how do i put a listbox into a textbox ??
> i tried to TextBox.Controls.Add( ListBox ), but it doesn't have the
> wanted effect.
>
> Any hints ? ( I'm relatively new to .NET and haven't studied the
> ComponentModel yet, but perhaps you might tell me how i can accomplish
> my task )
>
> Greetings and thanks in advance.
>
> Ole Viaud-Murat



Re: ListBox within TextBox / CodeCompletion by oviaudmurat

oviaudmurat
Fri Aug 22 18:05:22 CDT 2003

i found what i was looking for:
it's really trivial ... as an acquaintant said, you only have to
generate a new Form with FormBorderStyle = FormBorderStyle.None and
put a listbox to this new form. Then put the form under the current
cursor position of the TextBox.

But question follows:
how do i convert to position of the current insert caret of
a textbox to a System.Drawing.Point ?

i thought of

int ix = textbox.SelectionStart;
Point location = somehowconverttoPoint( ix, textbox );

thanks in advance.

oviaudmurat@web.de (Ole) wrote in message news:<c640408c.0308210309.2d3a227a@posting.google.com>...
> Indeed, that is an interesting article.
>
> I tried the ShellLib without diving to deep into its internals.
> But i think it is not possible ( without modifiying ShellLib.dll ), to
> bind the Autocompletion to a userdefined list when the control that is
> to be autocompleted is a TextBox. With a ComboBox, you might bind a
> user defined list to the AutoComplete Object.
>
> Further i need control over the Location of the AutoComplete ListBox,
> where
> it pops up. ( Excuse my bad english please ).
>
> Nevertheless, I plan to use ShellLib in other situations.
>
> Is there a way of modifiying the ShellLib.dll in order to:
> - bind a user defined SourceList to a RichTextBox - AutoComplete
> Object
> - obtain control over initial pop position of AutoComplete listbox
> - change appearance of listbox
> ?
>
>
>
>
> "Uriel Cohen" <uriel.cohen@philips.com> wrote in message news:<ediRb9xZDHA.2960@tk2msftngp13.phx.gbl>...
> > Hi, Ole!
> >
> > Check the following article. I think you'll find it very enlighting:
> >
> > http://www.codeproject.com/csharp/csdoesshell4.asp
> >
> > Uriel
> >
> > "Ole" <oviaudmurat@web.de> wrote in message
> > news:c640408c.0308200453.6dd98f10@posting.google.com...
> > > Hello out there,
> > > lang: csharp
> > > topic: ListBox in RichTextBox / sql / db / editors
> > >
> > > i am developing an sqlclientshellsystem, that makes it possible to
> > > connect to various sqlservers ( ms sqlserver, oracle, db2, ... ).
> > > Basic functionality is completed.
> > > Now i want to implement wordcompletion for different things:
> > > for example, if a user types in a tablename in order to specifiy the
> > > columns,
> > > i want to suggest the columns to him in form of a listbox popping up
> > > beneath the tablename. ( like it is known in many IDEs (
> > > Codecompletion or Intellisense ).
> > >
> > > I know that i have to maintain keword database, schema information and
> > > a like.
> > >
> > > The problem is, how do i put a listbox into a textbox ??
> > > i tried to TextBox.Controls.Add( ListBox ), but it doesn't have the
> > > wanted effect.
> > >
> > > Any hints ? ( I'm relatively new to .NET and haven't studied the
> > > ComponentModel yet, but perhaps you might tell me how i can accomplish
> > > my task )
> > >
> > > Greetings and thanks in advance.
> > >
> > > Ole Viaud-Murat

Re: ListBox within TextBox / CodeCompletion by oviaudmurat

oviaudmurat
Mon Aug 25 07:18:33 CDT 2003

I hope it doesn't seem that i am talking to myself,
but i must answer my silly question about the Caret to Point conversion.
RTFM!!

Point caretPoint = RichTextBox.GetPosFromCharIndex( currentIndex )


is the answer

Thanks either

oviaudmurat@web.de (Ole) wrote in message news:<c640408c.0308221505.3d518500@posting.google.com>...
> i found what i was looking for:
> it's really trivial ... as an acquaintant said, you only have to
> generate a new Form with FormBorderStyle = FormBorderStyle.None and
> put a listbox to this new form. Then put the form under the current
> cursor position of the TextBox.
>
> But question follows:
> how do i convert to position of the current insert caret of
> a textbox to a System.Drawing.Point ?
>
> i thought of
>
> int ix = textbox.SelectionStart;
> Point location = somehowconverttoPoint( ix, textbox );
>
> thanks in advance.
>
> oviaudmurat@web.de (Ole) wrote in message news:<c640408c.0308210309.2d3a227a@posting.google.com>...
> > Indeed, that is an interesting article.
> >
> > I tried the ShellLib without diving to deep into its internals.
> > But i think it is not possible ( without modifiying ShellLib.dll ), to
> > bind the Autocompletion to a userdefined list when the control that is
> > to be autocompleted is a TextBox. With a ComboBox, you might bind a
> > user defined list to the AutoComplete Object.
> >
> > Further i need control over the Location of the AutoComplete ListBox,
> > where
> > it pops up. ( Excuse my bad english please ).
> >
> > Nevertheless, I plan to use ShellLib in other situations.
> >
> > Is there a way of modifiying the ShellLib.dll in order to:
> > - bind a user defined SourceList to a RichTextBox - AutoComplete
> > Object
> > - obtain control over initial pop position of AutoComplete listbox
> > - change appearance of listbox
> > ?
> >
> >
> >
> >
> > "Uriel Cohen" <uriel.cohen@philips.com> wrote in message news:<ediRb9xZDHA.2960@tk2msftngp13.phx.gbl>...
> > > Hi, Ole!
> > >
> > > Check the following article. I think you'll find it very enlighting:
> > >
> > > http://www.codeproject.com/csharp/csdoesshell4.asp
> > >
> > > Uriel
> > >
> > > "Ole" <oviaudmurat@web.de> wrote in message
> > > news:c640408c.0308200453.6dd98f10@posting.google.com...
> > > > Hello out there,
> > > > lang: csharp
> > > > topic: ListBox in RichTextBox / sql / db / editors
> > > >
> > > > i am developing an sqlclientshellsystem, that makes it possible to
> > > > connect to various sqlservers ( ms sqlserver, oracle, db2, ... ).
> > > > Basic functionality is completed.
> > > > Now i want to implement wordcompletion for different things:
> > > > for example, if a user types in a tablename in order to specifiy the
> > > > columns,
> > > > i want to suggest the columns to him in form of a listbox popping up
> > > > beneath the tablename. ( like it is known in many IDEs (
> > > > Codecompletion or Intellisense ).
> > > >
> > > > I know that i have to maintain keword database, schema information and
> > > > a like.
> > > >
> > > > The problem is, how do i put a listbox into a textbox ??
> > > > i tried to TextBox.Controls.Add( ListBox ), but it doesn't have the
> > > > wanted effect.
> > > >
> > > > Any hints ? ( I'm relatively new to .NET and haven't studied the
> > > > ComponentModel yet, but perhaps you might tell me how i can accomplish
> > > > my task )
> > > >
> > > > Greetings and thanks in advance.
> > > >
> > > > Ole Viaud-Murat