Author |
Topic: Rich Edit controls (Read 957 times) |
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Rich Edit controls
« Reply #1 on: Aug 31st, 2011, 9:32pm » |
|
on Aug 31st, 2011, 4:58pm, Nick wrote:| There does NOT seem to be an equivalent to "GETPARAFORMAT length" message. If I knew the relevant structure length, then I could use this to get the data |
|
Unless the PARAFORMAT2 structure has unusual packing requirements, you can find the length by adding together the sizes of the various members. A quick back-of-envelope calculation suggests that it's 64 bytes (9 * 4 + 13 * 2 + 2).
If you declare the structure in BBC BASIC code you can find the length using the DIM function, thus:
Code: DIM paraformat2{cbSize%, dwMask%, wNumbering{l&,h&}, wEffects{l&,h&}, \
\ dxStartIndent%, dxRightIndent%, dxOffset%, wAlignment{l&,h&}, \
\ cTabCount{l&,h&}, rgxTabs%, dySpaceBefore%, dySpaceAfter%, dyLineSpacing%, \
\ sStyle{l&,h&}, bLineSpacingRule&, bOutlineLevel&, wShadingWeight{l&,h&}, \
\ wShadingStyle{l&,h&}, wNumberingStart{l&,h&}, wNumberingStyle{l&,h&}, \
\ wNumberingTab{l&,h&}, wBorderSpace{l&,h&}, wBorderWidth{l&,h&}, wBorders{l&,h&}}
PRINT DIM(paraformat2{}) Richard.
|
|
Logged
|
|
|
|
Nick
New Member
member is offline


Gender: 
Posts: 33
|
 |
Re: Rich Edit controls
« Reply #2 on: Aug 31st, 2011, 9:56pm » |
|
on Aug 31st, 2011, 9:32pm, Richard Russell wrote:| If you declare the structure in BBC BASIC code you can find the length using the DIM function, thus: |
|
Thanks Richard - that is helpful (and thinking about it, now obvious! Sorry!)
With a statement in BBC4W that makes a call and puts the result in memory, is there an easy way to tell precisely how many bytes were returned to the memory space?
I presume that if you have allocated, say, 64 bytes, but the system returns void or false, then most of your allocated memory will NOT contain the data you expect!
Is there a way to tell this with a call such as:
SYS "SendMessage", hRichEdit%, EM_GETPARAFORMAT, 0, F%
Or is there an easier way to get the SYS call to put the data directly into a variable? The WinAPI says that the lparam should be a "Pointer to a PARAFORMAT structure that receives the paragraph formatting attributes of the current selection. "
I suppose I am asking "Is there a way to present the SYS call lparam so that it seems like an accessible structure to the Rich control, but is also a variable within your BBC prog?"
Thanks again
Nick
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Rich Edit controls
« Reply #3 on: Sep 1st, 2011, 08:12am » |
|
on Aug 31st, 2011, 9:56pm, Nick wrote:| With a statement in BBC4W that makes a call and puts the result in memory, is there an easy way to tell precisely how many bytes were returned to the memory space? |
|
No, there's no way of knowing unless the API call itself returns that information (several do).
Quote:| I suppose I am asking "Is there a way to present the SYS call lparam so that it seems like an accessible structure to the Rich control, but is also a variable within your BBC prog?" |
|
I'm not sure I fully understand the question, but you should be using the API as follows:
Code: DIM paraformat2{cbSize%, dwMask%, wNumbering{l&,h&}, wEffects{l&,h&}, \
\ dxStartIndent%, dxRightIndent%, dxOffset%, wAlignment{l&,h&}, \
\ cTabCount{l&,h&}, rgxTabs%, dySpaceBefore%, dySpaceAfter%, dyLineSpacing%, \
\ sStyle{l&,h&}, bLineSpacingRule&, bOutlineLevel&, wShadingWeight{l&,h&}, \
\ wShadingStyle{l&,h&}, wNumberingStart{l&,h&}, wNumberingStyle{l&,h&}, \
\ wNumberingTab{l&,h&}, wBorderSpace{l&,h&}, wBorderWidth{l&,h&}, wBorders{l&,h&}}
EM_GETPARAFORMAT = &43D
paraformat2.cbSize% = DIM(paraformat2{})
SYS "SendMessage", hRichEdit%, EM_GETPARAFORMAT, 0, paraformat2{} Richard.
|
|
Logged
|
|
|
|
Nick
New Member
member is offline


Gender: 
Posts: 33
|
 |
Re: Rich Edit controls
« Reply #4 on: Sep 1st, 2011, 1:33pm » |
|
OK - Thanks. That is helpful.
|
|
Logged
|
|
|
|
|