autocomplete list with images

Nov 18, 2009 at 3:16 PM

hello,

I want to create an autocomplete list with images. I succeded to add images list :

 

hisEditor.AutoComplete.RegisterImages(autocompleteIL);



And now I want to show the images in the list. How can I affect each image to each list member.

thanks.


 

Coordinator
Nov 18, 2009 at 3:23 PM

From Scintilla doc

Autocompletion list items may display an image as well as text. Each image is first registered with an integer type. Then this integer is included in the text of the list separated by a '?' from the text. For example, "fclose?2 fopen" displays image 2 before the string "fclose" and no image before "fopen". The images are in XPM format as is described for SCI_MARKERDEFINEPIXMAP The set of registered images can be cleared with SCI_CLEARREGISTEREDIMAGES and the '?' separator changed with

Basically this means you have to set the AutoComplete List using AutoComplete.ListString and follow the above convention.

Nov 18, 2009 at 3:37 PM

Great!! it works.

thanks a lot.

 

Sep 11, 2010 at 7:42 PM

This is a C# example to circumvent the XPM image file format for AutoComplete:

           
            // AutoComplete image resource:
            // - format:    png
            // - size:      16x16
            // - backcolor: magenta (255,0,255)
            ImageList imageList = new ImageList();
            imageList.Images.Add(Properties.Resources.autoComplete00Structure);
            imageList.Images.Add(Properties.Resources.autoComplete01Variable);
            imageList.Images.Add(Properties.Resources.autoComplete02Class);
            imageList.Images.Add(Properties.Resources.autoComplete03Method);
           
            List<string> list = new List<string>();
            list.Add("bool?0");
            list.Add("myVariable?1");
            list.Add("myClass?2");
            list.Add("myMethod?3");

            editor.AutoComplete.RegisterImages(imageList, Color.Magenta);
            editor.AutoComplete.List = list;