Jump to content
Developer Wiki and Function Reference Links ×

Processing resource lists


BillW

Recommended Posts

For processing resource lists, has anyone tried using the procedures begining with "ResList_"

 

ie  PROCEDURE   ResList_Init( uniqueID:STRING; objectType:INTEGER) ;

 

I'm trying to figure out where I can get a control's "UniqueID" say for a reference to a "CreateThumbnailPopup( dialog, ksymbolpop);" in a scripted dialog. Controls are normally referenced by number. I'm wondering if the "ResList_" procedures relate to only controls shown in the object info palette for PIO's.

 

I have a working dialog version using "symID  := BuildResourceList(16,0,'',numSyms);" but was wondering if there is a better way.

 

See the old school method shown in a prototype scripted dialog below

 

setactivesymbol.txt

Link to comment

I don't think I understand your question. I don't think any of the ResList (or ResourceList) items have anything to do with dialog box parts.

 

Resource List are for finding objects that are in the Resource Manager of either the active file, or library files.

 

To handle dialog boxes the functionality is similar in that you get an ID number for each "control", but it is not a "resource".

 

Or maybe I am completely off base and wrong. 😉

Link to comment

That's what I was trying to establish - that "ResList_" procedures were not applicable to dialog boxes - however see below. So if they relate to the Resource Manager where does the uniqueID:STRING come from - or is the uniqueID set from a call to "ResList_Init"

 

There is a call

 ResList_DlgInit( uniqueID:STRING; dlgID:INTEGER; ctrlID:INTEGER) ;

 

which says

Use this call during dialog initialization to associate a popup control or resource popup and initialized by the ResList_* calls of the uniqueID identifying the resource list data.

 

The problem is there are no examples in the "Script Function Reference"

 

Thanks anyway.

Link to comment

Just a note - I found out how to use uniqueID - see below. I just need to investigate further.

 

procedure test;
Var
  fID : STRING;
  itemName : STRING;
  onlyCurrentDocument,searchOnline, skipCurrentDocument : BOOLEAN;

begin
(* with settings
Top level symbols
Symbol-1
Symbol-2

Symbol folder Folder-1
Symbol-3
Symbol-4

Symbols in order of creation
*)

  fID := CreateUUID;
  ResList_Init(fID, 16);
  ResList_ActFolder(fID,'Folder-1'); {returns Symbol-3 in ResList_SelFAvail}

  {first available item in the resource popup}
  ResList_SelFAvail(fID,itemName,onlyCurrentDocument,searchOnline,skipCurrentDocument);
  message(itemname,' ',onlyCurrentDocument,' ',searchOnline,' ',skipCurrentDocument);
end;
run(test);

 

Link to comment

A follow up. I've got a dialog working using "ResList_" functions/procedures - see attached.

 

The only drawback is the selected folder includes symbols in that folder and all symbols in any nested folders which may be what you want. In the example in the first post I only display symbols in the selected folder and ignore nested folders.

 

I was hoping to use ResList_Filter( uniqueID:STRING; callback:PROCEDURE) ; to show only symbols in the selected folder. I have established that the callback is a function which I thought would be of the form:

function chksyms(symH : HANDLE) : BOOLEAN;
Var
  foldH : HANDLE;
begin
  foldH  := getobject(foldname);
  chksyms := (getparent(symH) = foldH);
end;

ResList_ActFolder(fID,foldname);
ResList_Filter(fID,chksyms);

 

Unfortunately this doesnt seem to work. Anyone have any ideas on the form of the callback?

Using ResList procedures/functions certainly make the code much simpler.

setactivesymbol_reslist.txt

Edited by BillW
code typo
Link to comment

Thanks to Kostadin Ivanov - "The problem is that at the moment  the function ResList_ActFolder and ResList_Filter cannot be used in one script. use only ResList_Filter"

The previous reslist version has been modified to be equivalent to the first version "setactivesymbol.txt" and uses the resource browser interface. It refers to symbols in the active document.

 

Alternatively use ResList_ActFolder if you are happy to display symbols in the specified folder and all symbols in any nested symbol folders.

The root folder is ResList_ActFolder(fID,'')

setactivesymbol_reslist v2.TXT

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...