Hi folks,
I would like to set some individual TabStops in a .NET-GUI-TextBox (OpenEdge 10.2b, Architect),
for displaying some Key-Value-Combinations nicely.
In VB.NET it can be done with the following API-Call:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As IntPtr, ByVal wMsg As Integer, _
ByVal wParam As Integer, ByRef lParam As Integer) As Integer
Private Const EM_SETTABSTOPS As Integer = &HCB
Dim tabs() As Integer = {20, 130}
SendMessage(TextBox1.Handle, EM_SETTABSTOPS, 2, tabs(0))
I didn't got it to work when I tried translating in ABL;
think the problem is, that the 4th parameter has to be a Reference (ByRef)
to the first element of an array - don't know how to do this.
(BTW: Setting TabStops in Listbox or ComboBox should work the same way.)
Thanks for any help!
Rolf
RolfM wrote:
think the problem is, that the 4th parameter has to be a Reference (ByRef)
to the first element of an array - don't know how to do this.
If you look in the ABL help for "Parameter passing syntax" at "Table 50: C# syntax matching ABL parameter modes" you'll note that INPUT-OUTPUT maps to "ref" in C#, which I assume is ByRef in VB.NET.
(I personally find C# to be closer to ABL in terms of readability - there's a really close mapping)
-- peter
Hi Peter
You put me in the right direction, I have now a solution that works.
For everyone who's interested in setting TabStops in .NET-TextBox:
Put the following Code in the Definition-Area of the Class-File:
PROCEDURE SendMessageA EXTERNAL "USER32.DLL" :
DEFINE INPUT PARAMETER piHwnd AS LONG.
DEFINE INPUT PARAMETER piMmsg AS LONG.
DEFINE INPUT PARAMETER piParam1 AS LONG.
DEFINE INPUT PARAMETER piParam2 AS LONG.
DEFINE RETURN PARAMETER piReturn AS LONG.
END PROCEDURE.
In the Constructor of the Class you put something like:
DEFINE VARIABLE iTabstop AS INTEGER EXTENT 2 NO-UNDO.
iTabstop[1] = 40.
iTabstop[2] = 60.
RUN SendMessageA (
txtInfo:Handle:ToInt32(), /* The :ToInt32() did the trick! */
203, /* Constant for setting TabStops */
2, /* Number of TabStops = Size of EXTENT */
iTabstop, /* Array with TabStops defined */
OUTPUT miDummy).
Thanks!