What is a 'Pre Defined List?

Started by oradba4u, March 01, 2015, 07:05:53 AM

Previous topic - Next topic

oradba4u

Below is a code snippet I got from searching the tech database.
Can someone enlighten me as to what a "perdefined list" is?
How do I get it into this code?


Example 1: Scrolling Multilinebox using a predefined list
 
#DefineSubRoutine MyDialogProc(Status_Handle, Status_Message, controlnum, res1, res2)
   ; DialogProcOptions Constants
   MSG_INIT         = 0                                  ; The one-time initilization
   MSG_BUTTONPUSHED = 2                                  ; Pushbutton or Picturebutton
   MSG_TIMER        = 1                                  ; Timer call
   RET_DO_CANCEL    = 0                                  ; Cancels dialog
   RET_DO_DEFAULT   = -1                                 ; Continue with default processing for control
   RET_DO_NOT_EXIT  = -2                                 ; Do not exit the dialog

   Switch Status_Message
      Case MSG_INIT
         DialogProcOptions( Status_Handle,MSG_TIMER,500 )
         Return( -1 )

      Case MSG_TIMER
         DialogContents = DialogControlGet( Status_Handle, 2, 3 )
         newdata = ItemExtract(counter,logdata,@LF)
         If DialogContents =="" Then DialogContents = newdata
         Else DialogContents = StrCat( DialogContents, @CRLF, newdata )
         DialogControlSet( Status_Handle, 2, 3, DialogContents )
         counter = counter + 1
         If counter>maxlines
           DialogProcOptions( Status_Handle,MSG_TIMER,0 );Disable timer
           Return( RET_DO_DEFAULT )
          EndIf
         Return(RET_DO_NOT_EXIT )

      Case MSG_BUTTONPUSHED
         TimeDelay( .5 )
         Return( RET_DO_CANCEL )

   EndSwitch
   Return( 0 )

#EndSubRoutine

maxlines = 100
counter = 1

logData = ''
For item = 1 To maxlines
   If logdata == "" Then logData = 'line ': item : @LF
   Else logData = logData : 'line ': item : @LF
Next

MyDialogFormat=`WWWDLGED,6.1`

MyDialogCaption=`Logging Data`
MyDialogX=2001
MyDialogY=2001
MyDialogWidth=284
MyDialogHeight=185
MyDialogNumControls=004
MyDialogProcedure=`MyDialogProc`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0

MyDialog001=`079,165,120,012,PUSHBUTTON,DEFAULT,"Press to Stop",1,1,32,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`025,067,238,086,MULTILINEBOX,LogBox,DEFAULT,DEFAULT,4,8,DEFAULT,DEFAULT,DEFAULT`
MyDialog003=`025,053,044,010,STATICTEXT,DEFAULT,"Status",DEFAULT,5,DEFAULT,"Arial|5632|40|34","0|0|0",DEFAULT`
MyDialog004=`013,005,260,154,GROUPBOX,DEFAULT,DEFAULT,DEFAULT,6,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("MyDialog")

Exit



JTaylor

A "predefined list" is a list you define prior to launching your dialog.  Basically...

    my_list = "Item1":@TAB:"Item2":@TAB:"Item3"


would be an example.  With a Multiline box you might use a different delimiter.  I am guessing you are over-thinking it a bit.   It is just a variable assigned a delimited list of some sort.

Jim

stanl

To extend what Jim said, the basis of a pre-defined list could consist of logic to create/update from say a text file, an Office File (i.e. Excel or Access) or an ADO datasource. 

For example, say my website sold products in all 50 states, but my application only sold to certain states on any given day.  My WB app has either a list box or dropdown to allow me to select one or more of the states were sales were made on a given date. And assume my sales are kept in SQL Server:

I would first define a default list as

list=""

Then to get my data (after opening a recordset object)

"SELECT DISTINCT state from [mytable] where Date=[selected date] and Sales>0;"

Finally:  list = StrReplace(oRS.getstring(2),@LF,@TAB)

which gives my desired list, pre-defined by the backend data.