Compilation Error -Setting Popupmenu Value
hegedus
Hi,
Working on simple interface that filters a directory list of images bu key words in the filename. But getting a compilation error that I don't quite get.
This button controls the key word filter. The error is when I try to set the filtered list to another popup menu where the user can pick the individual image. The compiler is flagging an error saying that Imagelist is not a string or string function. But I have declared it as string.
Function PopUpStepSelction(pa) : PopupMenuControl
STRUCT WMPopupAction &pa
switch( pa.eventCode )
case 2: // mouse up
Variable popNum = pa.popNum
String popStr = pa.popStr
String ImageList
ImageList = IndexedFile(DataFolder, -1, ".tif")
variable index,maxindex
Maxindex=itemsInList(ImageList)-1
For(index =maxindex;index>0;index-=1)
if(stringmatch(stringFromList(index,ImageList), ("*"+popStr+"*"))==0)
imagelist = removeListItem(index,ImageList)
endif
endfor
PopUpMenu ImagePick value=ImageList //this is where error is identified
break
case -1: // control being killed
break
endswitch
return 0
End
So what completely obvious am I missing?
Andy
Hi,
Simplifying the issue:
This compiles:
This does not and the only difference is that I assign the result of the indexedfile function to an intermediate string variable.
I am officially confused.
Andy
March 4, 2021 at 10:52 am - Permalink
The help for PopUpMenu shows many scenarios for setting the PopUpMenu value, and the version that compiles is the recommended one in your situation.
If you need to use a local string variable as the value, the syntax is rather convoluted (for historical reasons):
PopUpMenu ImagePick value=#ImageList
March 4, 2021 at 12:51 pm - Permalink
Hi Jim,
Thank you for quick reply and while I won't go as far as to say I understand, I am back in business which is the important thing.
Andy
March 4, 2021 at 01:04 pm - Permalink