Subscribe Bookmark RSS Feed

Combo Box - how to quickly collapse its menu?

djhanson

Community Trekker

Joined:

Jun 23, 2011

Hi, does anyone know any way(s) to quickly collapse the menu of a Combo Box once the selection is made?  I have a Combo Box and do a get selected to get the selection then it proceeds to another script which takes maybe another 5 sec to fully initiate.  But during this 5 sec, the Combo Box menu remains open and will not collapse until the other script finishes.  I would like to have the Combo Box menu collapse nearly instantaneously after the get selected.  I found that changing the focus does this (e.g. caption then remove caption), but this is kind of kludgy.  Any other thoughts?  thanks, DJ

4 REPLIES
uday_guntupalli

Community Trekker

Joined:

Sep 15, 2014

Dj, 

     Can you provide a sample script , so it can be reproduced ? It will be helpful to think of the options .

 

Best 

Uday 

Best
Uday
Kaos

Community Member

Joined:

Jan 12, 2017

did you put a wait(0) at the beginning of the 2nd script?
djhanson

Community Trekker

Joined:

Jun 23, 2011

Thanks for the suggestions.  I did try a wait(0) and it was to no avail.  Here's an example:


Issue: combo box menu does not collapse quickly after selection as it waits for the following "slowJSL.jsl" to process (I want it to process post menu selection of course).  In this case "slowJSL.jsl" takes say 5 sec or so to process.  The key here, is that the menu post selection just hangs and stays open in the meantime.  I was hoping to close it quickly after the selection took place.

new window("test",

cb1=combo box({"<choose>","apple","orange","banana","kiwi","tangerine"},

fruit=cb1<<get text;

include(myPath || "slowJSL.jsl")

)

);


Fix (though I wonder if there isn't a better way):

new window("test",

cb1=combo box({"<choose>","apple","orange","banana","kiwi","tangerine"},

cb1<<set(1);caption("");caption(remove); //caption causes combo box menu to collapse quickly (good thing)

fruit=cb1<<get text;

include(myPath || "slowJSL.jsl")

)

);

ms

Super User

Joined:

Jun 23, 2011

I'm not able to reproduce the problem. For the code below, the combo box collapses quickly (JMP 13 for Macintosh).

Not sure what's going on. Your "slowJSL" may contain code that can take advantage of all computing resources (multiprocessing?). 

// Save example of a "slow" jsl file  
Save Text File("$SAMPLE_SCRIPTS/slowJSL.jsl", "repeat({char(randominteger(1,1e6))},1e7);
    print(fruit)");
New Window("test",
    cb1 = Combo Box(
        {"<choose>", "apple", "orange", "banana", "kiwi", "tangerine"},
        fruit = cb1 << get text;
        Include("$SAMPLE_SCRIPTS/slowJSL.jsl");
    )
);
// Delete example jsl by running the line below
// Delete File("$SAMPLE_SCRIPTS/slowJSL.jsl");