Charly Dante
2014-01-15 12:53:41 UTC
*Sorry for the double post, I accidentaly deleted my original question*
Hi,
I have again a question about some scintilla behaviour. The thing is, I
want to count the number of fold-points (the plus/minus points which are
used to open or close a code-folding section) in the current Scintilla edit
control.
For this porpuse, I use the following function:
unsigned int getSciFoldCount(HWND sciHwnd)
{
unsigned int lineCount = SendMessage(sciHwnd, SCI_GETLINECOUNT, 0, 0);
unsigned int foldCounter = 0;
for (unsigned int i = 0; i < lineCount; i++)
{
if ((SendMessage(sciHwnd, SCI_GETFOLDLEVEL, i, 0) &
SC_FOLDLEVELHEADERFLAG) > 0)
{
if (SendMessage(sciHwnd, SCI_GETFOLDEXPANDED, i, 0) == 1)
foldCounter++;
}
}
return foldCounter;
}
This works and delivers the correct amount of fold-points of the document,
but *only if I first scrolled down to the bottom* of the edit control. If
the text of the edit-control is too long to fit in the visible area (so
that scrolling is required) and I don't scroll down one time, the function
above only counts the visible fold-points. If I once scrolled down, I can
scroll up again and the function will return the correct amount of
fold-points. However I want it to return the correct value regardless of
the users scrolling behaviour, even if he didn't scroll yet at all.
How is it possible to achieve this?
Best regards,
CD
Hi,
I have again a question about some scintilla behaviour. The thing is, I
want to count the number of fold-points (the plus/minus points which are
used to open or close a code-folding section) in the current Scintilla edit
control.
For this porpuse, I use the following function:
unsigned int getSciFoldCount(HWND sciHwnd)
{
unsigned int lineCount = SendMessage(sciHwnd, SCI_GETLINECOUNT, 0, 0);
unsigned int foldCounter = 0;
for (unsigned int i = 0; i < lineCount; i++)
{
if ((SendMessage(sciHwnd, SCI_GETFOLDLEVEL, i, 0) &
SC_FOLDLEVELHEADERFLAG) > 0)
{
if (SendMessage(sciHwnd, SCI_GETFOLDEXPANDED, i, 0) == 1)
foldCounter++;
}
}
return foldCounter;
}
This works and delivers the correct amount of fold-points of the document,
but *only if I first scrolled down to the bottom* of the edit control. If
the text of the edit-control is too long to fit in the visible area (so
that scrolling is required) and I don't scroll down one time, the function
above only counts the visible fold-points. If I once scrolled down, I can
scroll up again and the function will return the correct amount of
fold-points. However I want it to return the correct value regardless of
the users scrolling behaviour, even if he didn't scroll yet at all.
How is it possible to achieve this?
Best regards,
CD
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.