IDAPython 8.4
Loading...
Searching...
No Matches
Form Class Reference
Inheritance diagram for Form:

Classes

class  ButtonInput
 
class  ChkGroupControl
 
class  ChkGroupItemControl
 
class  ColorInput
 
class  Control
 
class  DirInput
 
class  DropdownListControl
 
class  EmbeddedChooserControl
 
class  FileInput
 
class  FormChangeCb
 
class  GroupControl
 
class  GroupItemControl
 
class  InputControl
 
class  LabelControl
 
class  MultiLineTextControl
 
class  NumericArgument
 
class  NumericInput
 
class  NumericLabel
 
class  RadGroupControl
 
class  RadGroupItemControl
 
class  StringArgument
 
class  StringInput
 
class  StringLabel
 

Public Member Functions

 __init__ (self, form, controls)
 Contruct a Form class.
 
 Free (self)
 Frees all resources associated with a compiled form.
 
 __getitem__ (self, name)
 Returns a control object by name.
 
 Add (self, name, ctrl, mkattr=True)
 Low level function.
 
 FindControlById (self, id)
 Finds a control instance given its id.
 
 AddControls (self, controls, mkattr=True)
 Adds controls from a dictionary.
 
 CompileEx (self, form)
 Low level function.
 
 Compile (self)
 Compiles a form and returns the form object (self) and the argument list.
 
 Compiled (self)
 Checks if the form has already been compiled.
 
 Execute (self)
 Displays a modal dialog containing the compiled form.
 
 Open (self)
 Opens a widget containing the compiled form.
 
 EnableField (self, ctrl, enable)
 Enable or disable an input field.
 
 ShowField (self, ctrl, show)
 Show or hide an input field.
 
 MoveField (self, ctrl, x, y, w, h)
 Move/resize an input field.
 
 GetFocusedField (self)
 Get currently focused input field.
 
 SetFocusedField (self, ctrl)
 Set currently focused input field.
 
 RefreshField (self, ctrl)
 Refresh a field.
 
 Close (self, close_normally)
 Close the form.
 
 GetControlValue (self, ctrl)
 Returns the control's value depending on its type.
 
 SetControlValue (self, ctrl, value)
 Set the control's value depending on its type.
 

Static Public Member Functions

 create_string_buffer (value, size=None)
 
 fieldtype_to_ctype (tp, i64=False)
 Factory method returning a ctype class corresponding to the field type string.
 
 ControlToFieldTypeIdAndSize (ctrl)
 Converts a control object to a tuple containing the field id and the associated buffer size.
 

Public Attributes

 form = form
 
 controls = controls
 
 title = None
 
bool modal = True
 
int openform_flags = 0
 
int modal = 1
 
 p_fa
 

Static Public Attributes

str FT_ASCII = 'A'
 
str FT_SEG = 'S'
 
str FT_HEX = 'N'
 
str FT_SHEX = 'n'
 
str FT_COLOR = 'K'
 
str FT_ADDR = '$'
 
str FT_UINT64 = 'L'
 
str FT_INT64 = 'l'
 
str FT_RAWHEX = 'M'
 
str FT_FILE = 'f'
 
str FT_DEC = 'D'
 
str FT_OCT = 'O'
 
str FT_BIN = 'Y'
 
str FT_CHAR = 'H'
 
str FT_IDENT = 'I'
 
str FT_BUTTON = 'B'
 
str FT_DIR = 'F'
 
str FT_TYPE = 'T'
 
str FT_FORMCHG = '%/'
 
str FT_ECHOOSER = 'E'
 
str FT_MULTI_LINE_TEXT = 't'
 
str FT_DROPDOWN_LIST = 'b'
 
str FT_HTML_LABEL = 'h'
 
str FT_CHKGRP = 'C'
 
str FT_CHKGRP2 = 'c'
 
str FT_RADGRP = 'R'
 
str FT_RADGRP2 = 'r'
 
 DefI64
 
 argtypes
 

Protected Member Functions

 _reset (self)
 
 _AddGroup (self, Group, mkattr=True)
 
 _ChkCompiled (self)
 

Static Protected Member Functions

 _ParseFormTitle (form)
 

Static Protected Attributes

str _FT_USHORT = '_US'
 

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
form,
controls )

This class wraps around ask_form() or open_form() and provides an easier / alternative syntax for describing forms. The form control names are wrapped inside the opening and closing curly braces and the control themselves are defined and instantiated via various form controls (subclasses of Form).

Parameters
formThe form string
controlsA dictionary containing the control name as a key and control object as value

Member Function Documentation

◆ __getitem__()

__getitem__ ( self,
name )

◆ _AddGroup()

_AddGroup ( self,
Group,
mkattr = True )
protected
Internal function.
This function expands the group item names and creates individual group item controls

@param Group: The group class (checkbox or radio group class)

◆ _ChkCompiled()

_ChkCompiled ( self)
protected

◆ _ParseFormTitle()

_ParseFormTitle ( form)
staticprotected
Parses the form's title from the form text

◆ _reset()

_reset ( self)
protected
Resets the Form class state variables

◆ Add()

Add ( self,
name,
ctrl,
mkattr = True )

Prefer AddControls() to this function. This function adds one control to the form.

Parameters
nameControl name
ctrlControl object
mkattrCreate control name / control object as a form attribute

◆ AddControls()

AddControls ( self,
controls,
mkattr = True )

The dictionary key is the control name and the value is a Form.Control object

Parameters
controlsThe control dictionary

◆ Close()

Close ( self,
close_normally )
Parameters
close_normally1: form is closed normally as if the user pressed Enter 0: form is closed abnormally as if the user pressed Esc
Returns
: None

◆ Compile()

Compile ( self)

The form object will contain object names corresponding to the form elements

Returns
: It will raise an exception on failure. Otherwise the return value is ignored

◆ Compiled()

Compiled ( self)
Returns
: Boolean

◆ CompileEx()

CompileEx ( self,
form )

Compiles (parses the form syntax and adds the control) the form string and returns the argument list to be passed the argument list to ask_form().

The form controls are wrapped inside curly braces: {ControlName}.

A special operator can be used to return the index of a given control by its name: {id:ControlName}. This is useful when you use the STARTITEM form keyword to set the initially focused control. (note that, technically, the index is not the same as the ID; that's because STARTITEM uses raw, 0-based indexes rather than control IDs to determine the focused widget.)

Parameters
formCompiles the form and returns the arguments needed to be passed to ask_form()

◆ ControlToFieldTypeIdAndSize()

ControlToFieldTypeIdAndSize ( ctrl)
static

◆ create_string_buffer()

create_string_buffer ( value,
size = None )
static

◆ EnableField()

EnableField ( self,
ctrl,
enable )
Returns
: False - no such control

◆ Execute()

Execute ( self)
Returns
: 1 - ok ; 0 - cancel

◆ fieldtype_to_ctype()

fieldtype_to_ctype ( tp,
i64 = False )
static

◆ FindControlById()

FindControlById ( self,
id )

◆ Free()

Free ( self)

Make sure you call this function when you finish using the form.

◆ GetControlValue()

GetControlValue ( self,
ctrl )
Parameters
ctrlForm control instance
Returns
: - color button, radio controls: integer
  • file/dir input, string input and string label: string
  • embedded chooser control (0-based indices of selected items): integer list
  • for multilinetext control: textctrl_info_t
  • dropdown list controls: string (when editable) or index (when readonly)
  • None: on failure

◆ GetFocusedField()

GetFocusedField ( self)
Returns
: None if no field is selected otherwise the control ID

◆ MoveField()

MoveField ( self,
ctrl,
x,
y,
w,
h )
Returns
: False - no such fiel

◆ Open()

Open ( self)

◆ RefreshField()

RefreshField ( self,
ctrl )
Returns
: False - no such control

◆ SetControlValue()

SetControlValue ( self,
ctrl,
value )
Parameters
ctrlForm control instance
value
  • embedded chooser: a 0-base indices list to select embedded chooser items
  • multilinetext: a textctrl_info_t
  • dropdown list: an integer designating the selection index if readonly a string designating the edit control value if not readonly
Returns
: Boolean true on success

◆ SetFocusedField()

SetFocusedField ( self,
ctrl )
Returns
: False - no such control

◆ ShowField()

ShowField ( self,
ctrl,
show )
Returns
: False - no such control

Member Data Documentation

◆ _FT_USHORT

str _FT_USHORT = '_US'
staticprotected

◆ argtypes

argtypes
static

◆ controls

controls = controls

◆ DefI64

DefI64
static

◆ form

form = form

◆ FT_ADDR

str FT_ADDR = '$'
static

◆ FT_ASCII

str FT_ASCII = 'A'
static

◆ FT_BIN

str FT_BIN = 'Y'
static

◆ FT_BUTTON

str FT_BUTTON = 'B'
static

◆ FT_CHAR

str FT_CHAR = 'H'
static

◆ FT_CHKGRP

str FT_CHKGRP = 'C'
static

◆ FT_CHKGRP2

str FT_CHKGRP2 = 'c'
static

◆ FT_COLOR

str FT_COLOR = 'K'
static

◆ FT_DEC

str FT_DEC = 'D'
static

◆ FT_DIR

str FT_DIR = 'F'
static

◆ FT_DROPDOWN_LIST

str FT_DROPDOWN_LIST = 'b'
static

◆ FT_ECHOOSER

str FT_ECHOOSER = 'E'
static

◆ FT_FILE

str FT_FILE = 'f'
static

◆ FT_FORMCHG

str FT_FORMCHG = '%/'
static

◆ FT_HEX

str FT_HEX = 'N'
static

◆ FT_HTML_LABEL

str FT_HTML_LABEL = 'h'
static

◆ FT_IDENT

str FT_IDENT = 'I'
static

◆ FT_INT64

str FT_INT64 = 'l'
static

◆ FT_MULTI_LINE_TEXT

str FT_MULTI_LINE_TEXT = 't'
static

◆ FT_OCT

str FT_OCT = 'O'
static

◆ FT_RADGRP

str FT_RADGRP = 'R'
static

◆ FT_RADGRP2

str FT_RADGRP2 = 'r'
static

◆ FT_RAWHEX

str FT_RAWHEX = 'M'
static

◆ FT_SEG

str FT_SEG = 'S'
static

◆ FT_SHEX

str FT_SHEX = 'n'
static

◆ FT_TYPE

str FT_TYPE = 'T'
static

◆ FT_UINT64

str FT_UINT64 = 'L'
static

◆ modal [1/2]

int modal = True

◆ modal [2/2]

int modal = 1

◆ openform_flags

int openform_flags = 0

◆ p_fa

p_fa

◆ title

title = None

The documentation for this class was generated from the following file: