Component editrecords
Component index
Section index

Component editrecords


Search

Type

Function

Summary

Present a record list

Description

Allow edition, selection and other actions. The record list is presented as multi-column. It is refreshed as needed whenever a member change somewhat.

void add ()
void clickhead (int column, UISTATE &state)
void editone (int no, UISTATE &uistate)
void guidialog ()
void head ()
void load (int column, SORT_ORDER order)
void message ()
void otherbuttons (MENU_STATUS code, int id)
void pickone (int no, UISTATE &uistate)

Prototypes

void editrecords (const char *title, const char *intro, HELP_FILE &help)

void editrecords (const char *title, const char *intro, HELP_FILE &help, const char *diactx)

Functags

void add () Optional

The Add button was hit

The addwhat() fhelper controls the presence of the Add button. Whenever Add is selected, this functag is called.

void clickhead (int column, UISTATE &state) Optional

Called when a column button was clicked

void editone (int no, UISTATE &uistate) Optional

One record was selected, generally for edition

void guidialog () Optional

Used to create more complex GUI layouts

The editrecords works in graphical, text and html mode. In GUI mode more complex dialog may be created. The gui_passthrough(), newf_clist() and the various new_button() fhelpers are used.

void head () Mandatory

Define the heading of the table

The records are presented in tabular form. You generally use the newf_head() fhelper function to setup the heading. You also use various other helpers to setup extra buttons and dialog attributes

void load (int column, SORT_ORDER order) Mandatory

Define the content of the table

The new_menuitem() fhelper function is used to define the content of the table. You generally do the sorting here as well.

void message () Optional

Called when a MENU_MESSAGE event is received

The functags generally used the dialog_testmessage() to check which message was received.

void otherbuttons (MENU_STATUS code, int id) Optional

Called when other buttons (not add) is depressed

You can defined arbitrary buttons in the editrecords dialog.

void pickone (int no, UISTATE &uistate) Optional

One item is selected

Unlike the editone() functag, editrecords ends after this call. So pickone is used to select a single item and then goaway. So pickone or editone are never used together.

Fhelpers

void addwhat (const char *text)

A small explanation about the puppose of the add button

The function also triggers the presentation of the Add button. Editrecords normally does not put a Add button. You need the add() functag to tell when the add button has been used.

void delwhat (const char *text)

A, small explanation about the purpose of the Del button

You use the otherbuttons() functag to process the Del button.

void endedit ()

Request the edit loop to end

Generally called from an editone(), add(), otherbuttons() and message() functag. The dialog will end after that.

const char * get_lookup (int no)

Retrieve the key stored with set_lookup

int getnext (int cur)

Return the next record based on the current sort

The sort is generally controlled internally by editrecords. So if an application wishes to provide navigation button to jump to the next record, it uses this

int getprev (int cur)

Return the previous record based on the current sort

The sort is generally controlled internally by editrecords. So if an application wishes to provide navigation button to jump to the previous record, it uses this

void gui_passthrough (int cmd, const char *ctl, ...)

Define a GUI element

Used in the guidialog() functag to create more complex dialogs.

void new_button (int id, const char *label, const char *help)

Define a new button in the guilayout

You create a new button and assign it some ID. The otherbuttons() functag will be called with this ID whenever the button is depressed.

void new_button_help ()

Define a little help button with an icon

void new_button_icon (int id, const char *icon, const char *help)

Define a new button with an icon (no label)

Like new_button, you assign some ID and process the event with otherbuttons() functag. This is used in the guidialog functag

void new_menuitem (const char *column0, const char *rest)

Define one table entry

void new_menuitemf (const char *column0, const char *ctl, ...)

Define one table entry

Use a printf syntax to define one line of the table. The various columns are separated by tabs.

void newf_chk (const char *prompt, char &var, const char *title)

Define a check-box field

This is used in the guidialog() functag to define a check-box UI element.

void newf_clist ()

Position the record list in the guilayout

This is used in the guidialog functag, to position the list within the other UI components

void newf_head (const char *s)

Define the heading of the table

void newf_str (const char *prompt, SSTRING &var)

Define a text field

This is used in the guidialog functag to define a text field UI element

void newline ()

Define a newline GUI element

This is used in the guidialog functag

void nobutton ()

Indicate we do not want a "dismiss" button at the bottom of the dialog

This is generally used in the guilayout() functag, when we take over button placement.

void selectsort (int head)

Emulate the effect of clicking on one column button.

This column will become the key. If it was already the sort, the order is changed. This function is the default behavior when the clickhead functag is not used.

void set_button (int id, const char *text)

Replace the label of a button

This is generally used during the edit cycle to change the label of a button, ot reflect a different action. The button was defined using the new_button() fhelper.

void set_button_icon (int id, const char *icon)

Replace the icon of a button

The button was defined by new_button_icon().

void set_button_on_side ()

Select a different dialog layout with button on the right side

void set_lookup (int index)

Assign a different index to the last record set by new_menuitem

editone and pickone functag are passing a parameter "no" telling you which record was selected. This may not correspond to the array you used in the load functag. For example, you may have done some filtering and only few entries have been "loaded". set_lookup() tells editrecord what is the real index (in your own table) of the last new_menuitem(). editone and pickone will then pass index in "your word"

void set_lookup (const char *key)

Assign a key to the last record set by new_menuitem

editone and pickone functag are passing a parameter "no" telling you which record was selected. This may not correspond to the array you used in the load functag. For example, you may have done some filtering and only few entries have been "loaded". set_lookup() tells editrecord what is the real key (in your own table) of the last new_menuitem(). editone and pickone will then use get_lookup(no) to retrieve the key meaningfull in "your world"

void setbutinfo (int id, const char *label, const char *icon)

Define one button at the bottom of the dialog

void setcontext (const char *guictx)

Define the GUI context for reparenting the dialog

Normally a dialog is either swallowed in a multi-document interface if one is defined, or standalone. You control where it may be swallowed. The parameter is generally received from a more complex dialog.

void setcursor (int row)

Select the current row

void setdefaultdcs (const char *dcs)

Define the default drawing context for the records

This allows you to select a different font, pen and brush to draw the records. See guiid_setdc(). guiid_setfont(), guiid_setpen(), and guiid_setbrush()

void sethdispo (const char *hdispo)

Set the horizontal column disposition

For each column, you specify, using letter l,c or r, if it is left aligned, centered or right aligned.

void setnextdcs (const char *dcs)

Define the drawing context to use for the next record only

void setnexttagged ()

Specifies that the next record will be presented tagged (bold)

You use this function to specify that the next record (new_menuitemf()) will be shown in bold (marked)

void settype (DIALOG_TYPE type)

Define the dialog type

Generally used to request a popup

void setvsize (int rows)

Define the vertical size of the dialog

A vertical scroll bar is automatically placed when the list grow to a certain size. You can control this size

void sortable ()

Tells the component to place clickable title button for colum sorting

The user may click on the heading and sort according to the column. The application may also react differently if the user uses different mouse buttons. sortable() is implied by sortpolicy(). So most dialog will only set the sort policy and let editrecords handle the sorting. Now if you need custom sorting, call sortable() and not sortpolicy() and handle the sorting in the load functag.

void sortcolumn (int column, SORT_ORDER order)

Select the current sorting

This is generally used with contextual menu to force a particular column ordering.

void sortpolicy (const char *policy)

Specify how to sort each column

This tells editrecords it is responsible for sorting. For each column letter a or n specify if sorting is alphabetic or numeric.

void waitfor (PRIVATE_MESSAGE &msg)

Indicates that the dialog must react to this message

The message() functag will be called whenever this messages is sent.