mfc >> An autocomplete editor

by behzad » Thu, 27 Nov 2003 04:31:58 GMT

Hi,
I need an editor with autocomplete featue, something like the Vsual C
editor. What's the best way to implement it?

thanks,
Behzad




Similar Threads

1. AutoComplete in C++ Editor for Python

2. convert code written without editor to editor compatible?

I have an application in C# that was written as a bunch of individual CS 
files.  I would like to combine these all into single solution that can be 
editied with the Visual Studio 2003 editor.  Does anyone have any tips on 
how to quickly bring this code into the VS2003 environment?   Below is a 
sample of the code for an about box:  For this example, it wouldn't be all 
that difficult to just create a new form and set all the properties to match 
this code through the designer, but there are 20 other much more complex 
forms I would need to do the same thing for.

using System;
using System.Drawing;
using System.Windows.Forms;
using System.IO;

namespace ActiveNotes
{
 public class AboutBox: Form
 {

  private System.Windows.Forms.PictureBox pictureBox1;
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.Button btnOK;
/*
*
  public static void Main()
  {
   AboutBox dlg = new AboutBox();
   DialogResult dr = dlg.ShowDialog();
   Console.WriteLine("Dialog box terminated with " + dr);
  }
*/
  public AboutBox()
  {
   Text = "About ActiveNotes";
   StartPosition = FormStartPosition.CenterScreen;

   pictureBox1 = new System.Windows.Forms.PictureBox();
   label1 = new System.Windows.Forms.Label();
   labelVersion = new System.Windows.Forms.Label();
   btnOK = new System.Windows.Forms.Button();

   //Standard style for dialog boxes
   FormBorderStyle = FormBorderStyle.FixedDialog;
   //To allow cancel without buttons.
   //ControlBox      = false;
   MaximizeBox     = false;
   MinimizeBox     = false;
   ShowInTaskbar   = false;


   //
   // pictureBox1
   //
   this.pictureBox1.Image = 
Image.FromFile(Path.GetDirectoryName(Application.ExecutablePath)+"\\art\\splash2.jpg");
   this.pictureBox1.Location = new System.Drawing.Point(8, 8);
   this.pictureBox1.Name = "pictureBox1";
   this.pictureBox1.Size = new System.Drawing.Size(376, 296);
   this.pictureBox1.TabIndex = 7;
   this.pictureBox1.TabStop = false;

   //
   // label1
   //
   this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, 
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 
((System.Byte)(0)));
   this.label1.Location = new System.Drawing.Point(8, 312);
   this.label1.Name = "label1";
   this.label1.Size = new System.Drawing.Size(376, 23);
   this.label1.TabIndex = 1;
   this.label1.Text = "ActiveNotes 3.0 - Copyright 2003 ActiveGroup 
Ventures, Inc.";
   this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;




   //
   // btnOK
   //
   this.btnOK.Location = new System.Drawing.Point(296, 360);
   this.btnOK.Name = "btnOK";
   this.btnOK.TabIndex = 0;
   this.btnOK.Text = "OK";
   this.btnOK.Click += new System.EventHandler(this.OnOKClick);

   this.Controls.AddRange(new System.Windows.Forms.Control[] {
           this.labelVersion,
           this.btnOK,
           this.linkLabel1,
           this.label1,
           this.pictureBox1});

   ClientSize = new Size(392, 397);
   this.Load += new System.EventHandler(this.AboutBox_Load);



  }

  void OnOKClick(object obj, EventArgs ea)
  {
   DialogResult = DialogResult.OK;
  }

  protected override void OnPaint(PaintEventArgs pea)
  {
   Graphics g = pea.Graphics;

  }


  private void AboutBox_Load(object sender, System.EventArgs e)
  {
   this.ActiveControl = this.btnOK;
  }
 }



3. Autocomplete combobox with button click - CSharp / C#

4. TextBox AutoComplete not quite good enough

I want to have AutoSuggest based on a database (or webservice) query.  So as 
the user types say... a last name I will make an async call to a service to 
get matches, then set the suggestion list at runtime.

I tried this quick by handling the key down event and building a "dumb" 
Suggestion list and assigning to the TextBox control but it seem to lock the 
control up from any additional text input and the autocomplete list is not 
displayed.

Has anyone mananaged to put this feature of the TextBox to use beyond the 
built is sources? 


5. problem with Autocomplete and Leave focus event - CSharp/C#

6. Combobox Autocomplete SuggestAppend bug: Text with slash

Hi - I've been searching around for a fix but can't find one...

There is a bug with combobox autocomplete suggestappend.  When text has a 
slash, "ab/cd" for example, the autocomplete feature cuts off all text after 
the slash, "ab".

Also, the autocomplete feature doesn't work correctly.  It will not 
suggestappend when typing letters up to a slash or just move the cursor to 
the last character.

Is there a way to fix this?  I do not want to replace "/" with hyphens or 
anything like that.  This usually happens within data bound comboboxes and it 
happens all over my application.

Please help.  Thanks in advance!

7. Combobox with autocomplete - CSharp/C#

8. Autocomplete with big lookup table

I'm creating a database Winforms application using VCS Express 2005

I have some large lookup tables (may be up to 500000 records) which
contains name and id and are stored in sql server.

I need to create single line combobox style control which:

1. Allows to type first characters in name
2. Auto-completes entered data by using first match
3. Allows to open picklist based by entered data and select name

I tried to use Combobox with lookup table.
I can set combobox autocomplete source to lookup table and autocomplete
window shows matches very well.

Lookup parts table is big, it takes a lot of time to load the
data source.

I think I need virtual combobox control with autocomplete and selection from
list.

Is is not reasonable to load whole table as combobox lookup table during 
combobox
creation like ms doc sample recommends.


I have found 2 possibilities:

1. Add some code to combobox events to implement virtual mode. Is this
 possible ?

2. Create textbox, selection button and use (virtual?) DataGridView to
 emulate virtual dropdown list. In this case I must create UI in code
 also.

Which way is better ?
Where to find more information about this ?

Andrus.