Pat Stanford Posted March 25, 2023 Share Posted March 25, 2023 So I can use L2:=BuildResourceList(47,0,'',L1); To build a resource list of records in a document. This includes the parameter records of all PIOs in the file. But it does not include Record Formats that have been hidden using SetObjectVariableBoolean(HdToRecFormat, 900, False); Similarly, I can't get GetNameFromResourceList(L2,L1) To return the name of a Custom Record Format. It returns the name of PIOs correctly, but returns nothing for custom records. What am I missing? Procedure ListHiddenRecordFormats; VAR H1:Handle; S1:DynArray of Char; L1,L2,L3 :LongInt; BEGIN S1:='The file contains the following hidden record formats:'; S1:=Concat(S1, Chr(13), CHR(13)); L1:=BuildResourceList(47,0,'',L2); S1:=Concat(S1,L2,CHR(13)); For L3:=1 to L2 DO BEGIN If Not GetObjectVariableBoolean(GetResourceFromList(L1,L3),900) THEN S1:=Concat(S1,GetActualNameFromResourceList(L1,L3),CHR(13)); End; S1:=Concat(S1,'*****'); AlrtDialog(S1); End; Run(ListHiddenRecordFormats); Quote Link to comment
MullinRJ Posted March 25, 2023 Share Posted March 25, 2023 (edited) 2 hours ago, Pat Stanford said: What am I missing? Hey Pat, Hmmmmm, the secret sauce? I don't know why BuildResourceList() does not see Hidden Records, but judging from your example, it obviously doesn't. That said, I vaguely remember (meaning some old code I wrote shows) that Hidden Records are kept in a different list from the other records. The only way I can think of right now is to search that other list and use AddResourceToList() to place the Hidden Records into your list. Are you wanting your Resource List to contain only Hidden Records, All Records, or a mixture (Visible, PIO, Hidden)? I don't have a code sample to cut and paste right now because I wasn't using Resource Lists at the time, but I can mock one up shortly. Raymond Edited March 25, 2023 by MullinRJ Quote Link to comment
Pat Stanford Posted March 25, 2023 Author Share Posted March 25, 2023 I don't necessarily want a resource list. I just want a list of the names of all the hidden records in the file. Thanks for the help and helping me maintain that I am not crazy and what I was trying made sense but wasn't working. Quote Link to comment
MullinRJ Posted March 25, 2023 Share Posted March 25, 2023 Oh, Pat, you are crazy ...rational AND crazy... but you know what they say, it takes one to know one. 😉 Here ya' go. Here's my Secret Sauce recipe. Cut and Paste to your heart's delight. Procedure ListHiddenRecordFormats; CONST CR = chr(13); VAR S1 :DynArray of Char; Procedure HiddenRecordNames(var S1 :Dynarray of Char); { Append the names of all Hidden Records to text block S1. } { 25 Mar 2023 - Raymond J Mullin } Const RecordType = 47; DummyRec = 'DummyRec'; DummyFld = 'DummyFld'; Var hndDummyRec, RecHnd :Handle; Begin NewField(DummyRec, DummyFld, '1', 3, 0); { create dummy record } hndDummyRec := GetObject(DummyRec); { get handle to new record } SetObjectVariableBoolean(hndDummyRec, 900, False); { hide it } RecHnd := NextObj(hndDummyRec); { get handle to next object on list } DelObject(hndDummyRec); { not needed any more } while (RecHnd <> nil) do begin { traverse the Hidden Record list } if (GetType(RecHnd) = RecordType) then S1 := concat(S1, GetName(RecHnd), CR); RecHnd := NextObj(RecHnd); { Next Object on list } end; { while } End; { HiddenRecordNames } BEGIN S1:='The file contains the following hidden record formats:'; S1:=Concat(S1, CR, CR); HiddenRecordNames(S1); { append Hidden Record Names to text block } S1:=Concat(S1,'*****'); AlrtDialog(S1); END; Run(ListHiddenRecordFormats); Raymond 1 Quote Link to comment
Pat Stanford Posted March 25, 2023 Author Share Posted March 25, 2023 Thank you Raymond. Brilliant and Elegant as Usual. 👍 Quote Link to comment
JBenghiat Posted March 26, 2023 Share Posted March 26, 2023 As everyone has sleuthed out, hidden records are indeed in their own list. This is another instance where the Debug menu and Debug List View Ex comes in handy. Records are contained in a Data object, which contains regular records in it's standard list and hidden records in a Hidden Format container in the aux list. In theory, you could probably get there from FSymDef() and some crafty list traversal, but in VS or Python, Raymond's method is much easier and to the point. 1 Quote Link to comment
Recommended Posts
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.