Alpha Video Training
Results 1 to 11 of 11

Thread: Select all items in multi-select list box by default

  1. #1
    Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Versailles, KY
    Posts
    1,436

    Default Select all items in multi-select list box by default

    How can I "pre-select" all items (select all items by default) in a multi-select list box (X-Diaolog box)?

    Or can I at least add a button to an X-Dialog box to allow the user to select all items?
    Thanks.
    Jay Talbott

  2. #2
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,561

    Default Re: Select all items in multi-select list box by default

    Jay

    Set the resulting string to the initial string that contains the choices....
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  3. #3
    Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Versailles, KY
    Posts
    1,436

    Default Re: Select all items in multi-select list box by default

    Al,
    Thanks for the prompt response.
    I am initializing the choices through an array, and returning a carriage return, line feed list.

    DIM SHARED vc_labor_line as C
    DIM SHARED vc_target_job as C
    DIM SHARED varC_result as C
    auto_list_vc_labor_line = table.external_record_content_GET("job_labor", "row", "row", "job_number='"+vc_job_number+"'")

    temp_count = w_count(auto_list_vc_labor_line,crlf())
    DELETE a_vc_labor_line
    DIM a_vc_labor_line[temp_count] as c
    a_vc_labor_line.initialize(auto_list_vc_labor_line)

    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("Choose Labor lines to copy",<<%dlg%
    {region}
    Click on the line\(s) to copy:| [%M%.40,15vc_labor_line^#a_vc_labor_line];
    Enter target job number:| [.15vc_target_job];
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%)
    Not quite sure how to implement your suggestion.
    Thanks.
    Jay

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Select all items in multi-select list box by default

    vc_target_job is the variable that contains the selection(s) when the xdialog is done, correct? So if you fill this variable before the xdialog is shown, all the choices will appear as selected originally?

  5. #5
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,561

    Default Re: Select all items in multi-select list box by default

    From what I read,

    to select all -
    vc_labor_line= auto_list_vc_labor_line

    to blank the selection -
    vc_labor_line=""

    If you post the table, we can test it.

    or use debug(1) and/or a5_show_variable() with the local_variables() argument.
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  6. #6
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,062

    Default Re: Select all items in multi-select list box by default

    Al,

    to select all Button ---> vc_labor_line= auto_list_vc_labor_line
    It did not work for me. What did I missing on here?
    Code:
    if a_dlg_button ="all" then
        vMailList = auto_list_vMailList
        a_dlg_button =""
    end if
    
    if a_dlg_button ="unselect" then
        vMailList =""
        a_dlg_button =""
    end if
    I tried this but not sure how to check on the items?
    Code:
    if a_dlg_button ="all" then
        dim k as n
        dim vAll as c
        for k = k to w_count(auto_list_vMailList,crlf()) 'w_count(a_vMailList)
        	vMailList = vall+word(auto_list_vMailList,k,crlf())+crlf()
        	ui_msg_box("test","show me "+vMailList) 'I can see an item until end of item
        next
           'vMailList = auto_list_vMailList
        a_dlg_button =""
    end if
    CheckBox Sample.jpg

  7. #7
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,561

    Default Re: Select all items in multi-select list box by default

    Quote Originally Posted by johnkoh View Post
    Al,
    It did not work for me. What did I missing on here?
    Quote Originally Posted by Al Buchholz View Post
    or use debug(1) and/or a5_show_variable() with the local_variables() argument.
    You'll probably find that there are some formatting code that may need to be dealt with...

    so look at the variables and see what is there...
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  8. #8
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Select all items in multi-select list box by default

    Quoting Al.......

    If you post the table, we can test it.

    or use debug(1) and/or a5_show_variable() with the local_variables() argument.

  9. #9
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,062

    Default Re: Select all items in multi-select list box by default

    Hello,

    How about full scripts?

    Code:
    'Create an XDialog dialog box to prompt for parameters.
    dim vMailId as c ="00029" 'for test
    DIM SHARED vMailList as C
    DIM SHARED varC_result as C
    auto_list_vMailList = table.external_record_content_get("mail_list",\
    "padr(Name,60,' ')+'^'+alltrim(maillist_id)",\
    "Name","mail_id="+quote(vMailId))
    
    temp_count = w_count(auto_list_vMailList,crlf())
    DELETE a_vMailList
    DIM a_vMailList[temp_count] as c
    a_vMailList.initialize(auto_list_vMailList)
    
    'Create an XDialog dialog box to prompt for parameters.
    DIM SHARED vPrintList as C
    DIM SHARED varC_result as C
    'maillabel.set
    tables_sets_vPrintList = <<%filenames%
    Mail_list.dbf
    %filenames%
    
    'Get just the objects for the specified table/set names
    auto_list_vPrintList = a5enum("label",alltrim(tables_sets_vPrintList))
    
    temp_count = w_count(auto_list_vPrintList,crlf())
    DELETE a_vPrintList
    DIM a_vPrintList[temp_count] as c
    a_vPrintList.initialize(auto_list_vPrintList)
    
    ok_button_label = "&Print"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("List to Print",<<%dlg%
    {frame=1,1:List to Print:}
    {region}{lf};
     [.45,15vMailList^$$a_vMailList];
     <15,Select All!all> <15,Unselect!unselect>;
    {endregion};{lf};
    
    {frame=1,1:Print with:}
    {region}{lf};
     [.40vPrintList^=a_vPrintList];
    {endregion};{lf};
    {line=1,0};
    {region}{lf};
    
    <*15=ok_button_label!Print> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%,<<%code%
    if a_dlg_button ="all" then
         '  vMailList = auto_list_vMailList
        
        dim k as n
        dim vAll as c
        for k = k to w_count(auto_list_vMailList,crlf()) 'w_count(a_vMailList)
        	'vAll = k+auto_list_vMailList+crlf()
        	vMailList = vMailList+word(word(auto_list_vMailList,k,crlf()),2,"^")+crlf()
        	ui_msg_box("test","show me "+vMailList)
        next
        'vMailList = auto_list_vMailList
        a_dlg_button =""
    end if
    
    if a_dlg_button ="unselect" then
        vMailList =""
        a_dlg_button =""
    end if
    %code%)
    
    if varC_result="print" then
        dim vListIds as c
        vListIds = *for_each(x,"MailList_id = "+quote(word(alltrim(word(vMailList,2,"^")),1)), vMailList) 
        ui_msg_box("to print list",""+vListIds)
        filter = alltrim(vListIds)
        filter = stritran(filter,crlf()," .or. ")
    
        'Printing on selected reports
        filter = replace_parameters(filter,local_variables())
        	:label.preview(vPrintList,filter)	
    end if

  10. #10
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,561

    Default Re: Select all items in multi-select list box by default

    How can we look at this without a sample data table?
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  11. #11
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,062

    Default Re: Select all items in multi-select list box by default

    Stan and Al,

    Thank you

    After added it(script) on a Form Button, it works very, very well.
    One click, selected all and un-selected all.

    Thank you for help

Similar Threads

  1. Advanced Multi-select list box
    By trackmanpete in forum Alpha Five Version 8
    Replies: 10
    Last Post: 04-21-2007, 08:36 AM
  2. Multi select list box
    By Bill Parker in forum Application Server Version 8
    Replies: 4
    Last Post: 04-16-2007, 11:28 AM
  3. multi-select list box and filter
    By Ray Farland in forum Alpha Five Version 5
    Replies: 2
    Last Post: 04-15-2005, 04:11 AM
  4. Multi-Select List Box
    By Louis Nickerson in forum Alpha Five Version 5
    Replies: 10
    Last Post: 01-30-2003, 04:37 PM
  5. Improving the new Multi-Select List Box
    By Tom Mills in forum Alpha Five Version 5
    Replies: 2
    Last Post: 11-04-2002, 03:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •