Delphi尚不成熟,如果这是一个小问题,请原谅我。
我有以下内容:
TMsgDlgBtn = (mbYes,mbNo,mbOK,mbCancel,mbAbort,mbRetry,mbIgnore,mbAll,mbNoToAll,mbYesToAll,mbHelp,mbClose);
TMsgDlgButtons = set of TMsgDlgBtn;
和此循环:
//Buttons is of type TMsgDlgButtons and value is [mbRetry,mbCancel]
for B := Low(TMsgDlgBtn) to High(TMsgDlgBtn) do
if B in Buttons then
//Do something with the button B
似乎Buttons
处于哪个顺序中,总是先用mbCancel
处理,然后再用mbRetry
处理。我看到这是由于TMsgDlgBtn
的顺序所致,所以我尝试了以下方法:
for B in Buttons do
//Do something with the button B
但是它似乎以相同的方式进行迭代-先取消,然后重试。
这是因为Buttons
是集合吗?有什么方法可以遍历Buttons
从而遵守顺序吗?