I had to do this for spell check:
First, you need a reference to the current DocLayout (you can get this
from the current Frame's data), so assuming m_pFrame is a pointer to the
current frame (this is passed to dialogs when they run):
AP_FrameData * frameData = (AP_FrameData*) m_pFrame->getFrameData();
FL_DocLayout * docLayout = frameData->m_pDocLayout;
fl_DocSectionLayout * currSection = docLayout->getFirstSection();
And from a section, get the first block:
fl_BlockLayout * currBlock = currSection->getFirstBlock();
Then, use:
currBlock = currBlock->getNext();
until currBlock is NULL, then use:
currSection = currSection->getNext();
currBlock = currSection->getFirstBlock();
to move to the next section, and iterate through its blocks until hitting
NULL again. Repeat until the section->getNext() returns NULL.
Then, you're done.
An example can be found in:
abi/src/wp/ap/xp/ap_Dialog_Spell.cpp
specifically in runModal() and nextMisspelledWord()
Justin