User Guide

Programming i!-Database Plus
17
i!-Database Plus and DBWizard
}
FOR (; nLOOP <= sTempListBox.nDISPLAY_SIZE; nLOOP++)
{
(* CLEAN UP EMPTY ENTRIES HERE *)
SEND_COMMAND dvTP,"'!T',0+nLOOP,''"
SEND_COMMAND dvTP,"'!T',10+nLOOP,''"
}
SEND_COMMAND dvTP,"'!T',49,'Displaying ',ITOA(sTempListBox.snFIRST),'-',
ITOA(sTempListBox.snLAST),' of
',ITOA(sTempListBox.snTOTAL)"
SEND_LEVEL dvTP,1,sTempListBox.nLEVEL_VAL
sTitleListBox = sTempListBox
}
The next section creates a level for the scroll bar. Use this later to actively jump to any point in your
list.
(***********************************************************)
(* STARTUP CODE GOES BELOW *)
(***********************************************************)
DEFINE_START
(* Get Level for active slider *)
CREATE_LEVEL dvTP,1,nTITLE_LVL
The next section handles the request from the touch panel to manipulate your list. The first two
buttons are up and down. Use
DB_LISTBOX_UP and DB_LISTBOX_DOWN to manipulate your list
box. The next two buttons jump to the beginning and end of the list. Call
DB_LISTBOX_SET with a
value of 1 to go to the beginning and a value of
$FFFF to go to the end. The value $FFFF is used
here as a very large value. Anytime you try to set past the end of the list,
DB_LISTBOX_SET will
automatically make sure the selected value is inside the selected list. Using
$FFFF is an easy way to
force the function to automatically position to the end of the list. The last button is from your scroll
bar slider. Notice you capture the position on the release after you have stopped moving the level
and lifted your finger off the slider. Send the level you created earlier to
DB_LISTBOX_SET and set
the last parameter,
bFROM_SLIDER, to 1. DB_LISTBOX_SET will automatically scale the value and
select the position in the list that matches your request.
After you have adjusted your listbox, call
DB_READ_TITLES to build your SQL and send the
request to the server. When the response from this request comes in, your
DB_DISPLAY_TITLES
function will be called and our requests will be displayed. A template for calling this function was
generated by DBWizard and included in the include file. You can copy the call template from the
include file and paste it into your code.
(*******************************************)
(* DEVCHAN: Title Control *)
(*******************************************)
BUTTON_EVENT[dcTITLES_CTRL]
{
PUSH:
{
STACK_VAR nIDX
nIDX = GET_LAST(dcTITLES_CTRL)
SWITCH (nIDX)
{
CASE 1: DB_LISTBOX_UP (sTitleListBox)
CASE 2: DB_LISTBOX_DOWN (sTitleListBox)
CASE 3: DB_LISTBOX_SET (sTitleListBox,1,0)
CASE 4: DB_LISTBOX_SET (sTitleListBox,$FFFF,0)
}
DB_READ_TITLES(sTitleListBox,"")
Continued