Search code examples
user-interfacesearchwxwidgets

Widget with search facility in wxwidgets


I was wondering if there were any nice widgets in wxwidgets, with search ability. I mean searching for data in large tables like, data in wxgrid.
Thanks in advance


Solution

  • It would be slow and inefficient in several ways to store all of a large dataset in wxGrid, and then to search through wxGrid.

    It would be better to keep the dataset in a database and use the database engine to search through it. wxGrid need only store the data that is visible in the GUI.

    Here is some high level pseudo code of how this works.

    • Load data into store. The store should probably be a database, but it might be a vector or any STL container. Even a text file could be made to work!
    • Set current viewable row to a sensible value. I am assuming your data is arranged in rows
    • Load rows including and around current into wxGrid.
    • User enters search term
    • Send search request to data store, which returns row containing target
    • Set current row to row containing target
    • Load rows including and around current into wxGrid.