I'm using a richedit control in the freeware SDK visual designer
and am trying to add the option of allowing the user to set the
spacing for tabs. So far I have had no luck. Here is the
function I am using:
The SendMessage(hEdit, %EM_SETPARAFORMAT, 0, VARPTR(pf)) always
returns 0, which indicates failure. I pass the function the
handle to the edit control and the number of characters to use
for the tab interval. Anyone have any ideas as to what I am
doing wrong??
TIA... Ed
------------------
and am trying to add the option of allowing the user to set the
spacing for tabs. So far I have had no luck. Here is the
function I am using:
Code:
FUNCTION setRichTextTabs(BYVAL hEdit AS LONG, BYVAL tabStops AS LONG) AS LONG LOCAL pf AS PARAFORMAT, pd AS CHARRANGE, Events AS LONG 'Disable the event mask, for better speed Events = SendMessage(hEdit, %EM_GETEVENTMASK, 0, 0) SendMessage hEdit, %EM_SETEVENTMASK, 0, 0 ' Hide the selection to eliminate flickering SendMessage hEdit, %EM_HIDESELECTION, 1, 0 ' Select the entire text pd.cpmin = 0 pd.cpMax = -1 SendMessage hEdit, %EM_EXSETSEL, 0, VARPTR(pd) pf.cbSize = SIZEOF(pf) pf.dwMask = %PFM_TABSTOPS pf.cTabCount = %MAX_TAB_STOPS For i& = 0 To %MAX_TAB_STOPS - 1 pf.rgxTabs(i&) = i& * tabStops * 144 Next i& n& = SendMessage(hEdit, %EM_SETPARAFORMAT, 0, VARPTR(pf)) ' Deselect the text pd.cpmin = 0 pd.cpMax = 0 SendMessage hEdit, %EM_EXSETSEL, 0, VARPTR(pd) ' Turn selection back on SendMessage hEdit, %EM_HIDESELECTION, 0, 0 ' Reset the event mask IF Events THEN SendMessage hEdit, %EM_SETEVENTMASK, 0, Events End If FUNCTION = n& END FUNCTION ' setRichTextTabs
returns 0, which indicates failure. I pass the function the
handle to the edit control and the number of characters to use
for the tab interval. Anyone have any ideas as to what I am
doing wrong??
TIA... Ed
------------------
Comment