;Shows "Open" or "Save As" dialog and stores full path into
;str variable s. Returns 1 on Open or Save; 0 on Cancel.
;save – dialog type: 0 – "Open", 1 – "Save As".
;s – str variable that receives full path.
;filter – file types displayed in dialog. Consists of
;,description/pattern string pairs. Each string must end
;,with new line characters or null character.
;defext – default extension.
;initdir – str variable that sets initial directory
;,and receives selected file directory.
;;;;If initdir is not used, initial directory will be current
;;;;directory, and current directory may be changed. If initdir
;;;;is used, current directory will not be changed.
;title – dialog box title.
;nodereferencelinks - get path of shortcut file, not its target.
;multi - if used, Open dialog allows to select multiple files.
;;;;multi is populated with full paths. s can be 0.
;EXAMPLES
;str s
;if OpenSaveDialog2(0 &s "Text files[]*.txt[]All Files[]*.*[]" "txt")
;,out s
;ARRAY(str) a
;if(OpenSaveDialog2(0 0 "" "" 0 "" 0 a)) ,;for(int'i 0 a.len) out a[i]
Hi Gintaras,
I finally got a chance to work with the examples you gave me. Usually I can reverse engineer to what I need. I am having a little more difficulty this time. Hope you can help but I understand if too involved!
Here is what I am trying to do:
In this particular applications screen, there is a listbox like this:
Each line has a different value. In that value is a record number which I am trying to extract.
Right now I go down that list serially using a "next" navigation statement.
Since the length of the list is variable ~5 to 100, it would be much better if I could have the user select-highlight (using Ctrl-left click or Shift-left click - like normal Windows functionality) the desired entries, and then have only those get acted upon.
Ctrl-Left click and Shift-left click already work to highlight this list in the desired fashion, bu my macro currently just goes from the top to the bottom, using additional (n1, n2, n3, n4)navigation steps.
Is it possible to extract this in a MultiSelect fashion or do I have to go through a dialog like in your examples?
I geuss another way would be for a QM macro to see which have already been multi-selected natively in the App and then use those as the signs to which to navigate and pull the Value from.
ARRAY(Acc) se
a.Selection(se) int arraylength=se.len ARRAY(str) accessionarray.create(arraylength)
int i for i 0 se.len ,str v=se[i].Description ,findrx(v "\d{8}" 2 4 accession) ,out i ,out accession ,accessionarray[i]=accession ,
int choice if(!inp(choice "" "" "Enter number of choice")) ret out choice out accessionarray[choice]
I don't know much about ARRAYS so I had to kind of reverse engineer some examples. Apparently you have to define the size each time ahead of time, so that's what I did with
code]ARRAY(str) accessionarray.create(arraylength)[/code]
Is thatt right?
Anyway it seems to be working.
If I want to select the whole list automatically instead of user input, I can "extend selection" from first acc object to last acc object but I need to know the total number to do that. How can I get the total number of child windows of a given acc (the parent of the List Items)?
Hi Gintaras,
I am trying to get the 0-based index of all the selected items from a MULTISELECT LB.
I already know how to get the text of all the selected items out using:
Quote:Function LB_GetSelectedItems (universal)
;/
function hlb ARRAY(str)&a
;Gets text of selected items in a multiple-selection listbox.
int i n=SendMessage(hlb LB_GETSELCOUNT 0 0)
if(n=-1) ;;single-sel control
,a.redim(1)
,if(LB_SelectedItem(hlb a[0])<0) a.redim
else
,a.redim(n)
,if(n)
,,ARRAY(int) selitems.create(n)
,,SendMessage(hlb LB_GETSELITEMS n &selitems[0])
,,for(i 0 n) LB_GetItemText hlb selitems[i] a[i]
and I know how to get the 0-based index from a single-select listbox using LB_SelectedItem but not from a multiselect.
The LB_GetSelectedItems function seems to get them all out in one go via LB_GETSELITEMS so that i counter-variable doesn't refer to the original array index but the newly filled index of JUST the selected items.
Is there any way to extract an array of selected index positions rather than text?