inm logo
Corporate Website | Contact | Store | Support | Login  

View categorized listing of all common frequently asked questions.
View our categorized library of downloads for all necessary manuals, software, etc.
 Article Options
Support Center » Knowledgebase » INM V12 Database for Director » Synchronize scrolling multiple database fields
Support Page Banner
 Synchronize scrolling multiple database fields
INM V12 Database for DirectorWindows, MacintoshInterface and data-handling3.x Regular & Light


It can be useful to allow a user to scroll database values in a field on the screen. This technote shows and explain a convenient way of displaying multiple fields of a V12 Database selection in multiple scrolling Director members while keeping them properly aligned and synchronized when the user browses through the selection.


The secret resides in a clever use of mGetSelection. A single global variable is used to keep track of the number of the first record to display in the scrolling fields. For instance, let's imagine we have a "gTable" table opened, with two fields that we would like to scroll, "clothes" and "color".

First, we'll need two handlers that will create the selection each time the user clicks on an up or down arrow. The variable "gFirstRec" represent the first record to be shown.

on RecUp
-- Scroll one record up and refresh display
  if (gFirstRec = 1) then exit
     set gFirstRec = gFirstRec - 1
end RecUp

on RecDown
-- Scroll one record down and refresh display
  if (gFirstRec >= mSelectCount(gTable) ) then exit
    set gFirstRec = gFirstRec + 1
end RecDown

Next, the handler that will refresh the screen should look like the following script. The variable "kPageLenght" is a constant that remembers the number of record to show, depending on the field's height.

on ShowSelection
-- Show kPageLength records of the current selection, starting at record number gFirstRec
-- gTable must be valid upon entry of this handler
    put mGetSelection(gTable, "LITERAL", gFirstRec, kPageLength, TAB, RETURN, "clothes") into field "clotheslist"
    put mGetSelection(gTable, "LITERAL", gFirstRec, kPageLength, TAB, RETURN, "color") into field "colorlist"
end ShowSelection

To better comprehend this example, we recommend that you download the [free] sample available below and note that the scripts contained within are easily reusable in any Director movie!


This sample is supported on Director 6.5 and later. zip   sit

Article Details
Article ID: 103
Created On: 26 Sep 2006 02:20 PM

 This answer was helpful  This answer was not helpful

inm general footer
Services Xtras Go Products Support Gallery Store Download About Us Contact Newsroom