619 views
in GUI Development by

Hi,

I would like to implement a search window for items on a list. I have created a component with a vertical list whose contents are loaded from the array. I need advice on how to integrate Text Editor with vertical list to get this effect:

1 Answer

0 votes
by

Hello MaryStorer,

following would be the possible steps:

1. Create a component containing the Vertical List and the instance of the Text Editor component.

2. Add a slot method to the component.

3. Modify the Text Editor's property OnChange so it refers the slot method from the step 2.

4. In the slot method (step 2) implement code to filter the array items which do match the text entered in the Editor. The results matching the filter pattern should be stored in a separate array. For example:

var string filter = TextEditor.String;
var int32  i;
var int32  j;

// Search for entries matching the filter
for ( i = 0; i < Original_Array_Size; i++ )
  if ( Original_Array[i].find( filter, 0 ) >= 0 )
    Filtered_Array[j++] = Original_Array[i];

// Inform the list about its changed size
VerticalList.NoOfItems = j;
VerticalList.InvalidateItems( 0, j );

5. In the OnLoadItem slot method associated to the Vertical List use the entries from the filtered array.

I hope it helps you further.

Best regards

Paul Banach

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...