choose
summary: show tabular data
- description:
Shows how to subclass the ida_kernwin.Choose class to show data organized in a simple table. In addition, registers a couple actions that can be applied to it.
keywords: chooser, actions
see_also: choose_multi
level: intermediate
Attributes
Classes
Chooser wrapper class. |
Functions
|
|
Module Contents
- class choose.chooser_handler_t(thing)
Bases:
ida_kernwin.action_handler_t- thing
- activate(ctx)
Activate an action. This function implements the core behavior of an action. It is called when the action is triggered, from a menu, from a popup menu, from the toolbar, or programmatically.
- Returns:
non-zero: all IDA windows will be refreshed
- update(ctx)
Update an action. This is called when the context of the UI changed, and we need to let the action update some of its properties if needed (label, icon, …) In addition, this lets IDA know whether the action is enabled, and when it should be queried for availability again. Note: This callback is not meant to change anything in the application’s state, except by calling one (or many) of the “update_action_*()” functions on this very action.
- static compose_action_name(v)
- choose.actions_variants = ['A', 'B']
- choose.actname = 'choose:actA'
- class choose.MyChoose(title, nb=5, flags=0, modal=False, embedded=False, width=None, height=None)
Bases:
ida_kernwin.ChooseChooser wrapper class.
Some constants are defined in this class. Please refer to kernwin.hpp for more information.
- n = 0
- items
- icon = 5
- selcount = 0
- modal = False
- popup_names = ['Inzert', 'Del leet', 'Ehdeet', 'Ree frech']
- OnInit()
Initialize the chooser and populate it.
This callback is optional
- OnGetSize()
Get the number of elements in the chooser.
This callback is mandatory
- Returns:
the number of elements
- OnGetLine(n)
Get data for an element
This callback is mandatory
- Parameters:
n – the index to fetch data for
- Returns:
a list of strings
- OnGetIcon(n)
Get an icon to associate with the first cell of an element
- Parameters:
n – index of the element
- Returns:
an icon ID
- OnGetLineAttr(n)
Get attributes for an element
- Parameters:
n – index of the element
- Returns:
a tuple (color, flags)
- OnInsertLine(n)
User asked to insert an element
- Parameters:
sel – the current selection
- Returns:
a tuple (changed, selection)
- OnDeleteLine(n)
User deleted an element
- Parameters:
sel – the current selection
- Returns:
a tuple (changed, selection)
- OnEditLine(n)
User asked to edit an element.
- Parameters:
sel – the current selection
- Returns:
a tuple (changed, selection)
- OnRefresh(n)
The chooser needs to be refreshed. It returns the new positions of the selected items.
- Parameters:
sel – the current selection
- Returns:
a tuple (changed, selection)
- OnSelectLine(n)
User pressed the enter key, or double-clicked a selection
- Parameters:
sel – the current selection
- Returns:
a tuple (changed, selection)
- OnClose()
The chooser window is closed.
- show()
- make_item()
- choose.test_choose(modal=False, nb=10)
- choose.test_choose_embedded()