Home   Archive   Permalink



Text-list does not display all items

Just when I thought I understood it...
    
I have this application where I have a block of title strings, each followed by an associated file name. I want to extract the title strings from the block and put them into a text-list. I have condensed the operation into the following demo. When I run the program and use the 'Load' button, the text-list shows only the 13 of 16 items that will fit, and the scroll bar is inoperative. If I use the 'Debug' button to halt the program and probe the TITLE-LIST that is what should be in the text-list, everything is present; it just doesn't show. What am I not understanding?
    
Thank you. Demo follows.
    
R E B O L [
]
    
;; -- Titles and associated file names
SNIP-LIST: [
'Alert with OK or Cancel buttons' %AlertWithOKorCancel.txt
'CGI Display Header' %CGIDisplayHeader.txt
'CGI Emit HTML' %CGIEMitHtml.txt
'CGI get input fields' %CGIGetInput.txt
'CGI first lines' %CGIscriptheader.txt
'Datestamp yyyymmdd' %datestamp-yyyymmdd.txt
'File list current dir' %File-list-current-dir.txt
'Generate yyyymmddhhmmss' %GenerateYYYYMMDDHHMMSS.txt
'Get all image files in a folder' %GetAllImageFilesInFolder.txt
'Get yyyymmdd' %GetYYYYMMDD.txt
'Image String' %ImageString.txt
'REBOL Header' %RebolHeader.txt
'Request one file name' %RequestOneFilename.txt
'Timestamp hhmmss' %TimestampHHMMSS.txt
'Trap close button ' %TrapCloseButton.txt
'Clock on window' %WindowClock.txt
]
    
TITLE-LIST: [] ;; to hold just the titles
    
LOAD-BUTTON: does [
     TITLE-LIST: copy []
     TITLE-LIST: extract SNIP-LIST 2
     MAIN-LIST/data: TITLE-LIST
     show MAIN-LIST
]
    
SHOW-PICKED: does [
     set-face MAIN-PICKED copy MAIN-LIST/picked
]
    
MAIN-WINDOW: layout [
     MAIN-LIST: text-list 500x200 data TITLE-LIST [SHOW-PICKED]
     MAIN-PICKED: info 500
     across
     BUTTON 'Load' [LOAD-BUTTON]
     button 'Quit' [quit]
     button 'Debug' [halt]
]
    
view center-face MAIN-WINDOW
    
And now to show I am not crazy:
    
>> probe title-list
[
     'Alert with OK or Cancel buttons'
     'CGI Display Header'
     'CGI Emit HTML'
     'CGI get input fields'
     'CGI first lines'
     'Datestamp yyyymmdd'
     'File list current dir'
     'Generate yyyymmddhhmmss'
     'Get all image files in a folder'
     'Get yyyymmdd'
     'Image String'
     'REBOL Header'
     'Request one file name'
     'Timestamp hhmmss'
     'Trap close button '
     'Clock on window'
]
    
>> probe main-list/data
[
     'Alert with OK or Cancel buttons'
     'CGI Display Header'
     'CGI Emit HTML'
     'CGI get input fields'
     'CGI first lines'
     'Datestamp yyyymmdd'
     'File list current dir'
     'Generate yyyymmddhhmmss'
     'Get all image files in a folder'
     'Get yyyymmdd'
     'Image String'
     'REBOL Header'
     'Request one file name'
     'Timestamp hhmmss'
     'Trap close button '
     'Clock on window'
]


posted by:   Steven White       13-Nov-2015/14:30:40-8:00



I have discovered that if I put this line before the "layout:"
    
TITLE-LIST: extract SNIP-LIST 2
    
to fill up the TITLE-LIST block before generating the layout, the window comes up with the correct data in it and the scroll bar operational. BUT, I don't necessarily WANT TO have the TITLE-LIST built when the program starts. I might want to fill the TITLE-LIST from some place that I would choose only after the window was displayed and I could have a button available for doing the choosing.
    
It acts like generating the layout with the empty TITLE-LIST forever limits the size of the MAIN-LIST text-list data to what will fit in the initially-declared size of 500x200. I wonder if there is some setting somewhere I could change at run time.

posted by:   Steven White       13-Nov-2015/19:22:48-8:00



This is recurring topic which it would have been nice to have fixed as a convenience. You can use:
    
LOAD-BUTTON: does [
     clear MAIN-LIST/data
     insert MAIN-LIST/data extract SNIP-LIST 2
     MAIN-LIST/sld/redrag MAIN-LIST/lc / max 1 length? MAIN-LIST/lines
     show MAIN-LIST
]

posted by:   Nick       14-Nov-2015/21:31:04-8:00



There are a few entries about this at http://www.codeconscious.com/rebol/vid-notes.html

posted by:   Nick       14-Nov-2015/21:32:27-8:00