300 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

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...