You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
You don't need (to modify) RichEdit.inc to use MSFTEDIT.DLL
But it does look like you will need Ver.4.1 to have multi-line table cells.
That means loading the library and using the appropriate class control. Something like ..
Code:
#COMPILE EXE
#INCLUDE "WIN32API.INC"
'*** #INCLUDE "RichEdit.inc" 'or just define one Type and couple of Equates
TYPE EDITSTREAM DWORD '
dwCookie AS DWORD ' user value passed to callback as first parameter '
dwError AS DWORD ' last error '
pfnCallback AS DWORD '
END TYPE '
'
%EM_STREAMIN = %WM_USER + 73 '
%SF_RTF = &H0002 '
'*** '
%IDC_RICHEDIT1 = 101
FUNCTION REStreamInCB(BYVAL dwCookie AS DWORD, BYVAL pbBuff AS BYTE PTR, _
BYVAL cb AS LONG, BYREF pcb AS LONG) AS LONG
LOCAL psBuffer AS STRING PTR
psBuffer = dwCookie
pcb = MIN(LEN(@psBuffer), cb)
IF pcb > 0 THEN
POKE$ pbBuff, LEFT$(@psBuffer, pcb)
@psBuffer = MID$(@psBuffer, pcb + 1)
END IF
END FUNCTION
'------------------/REStreamInCB
FUNCTION REStreamIn(BYVAL hEd AS DWORD, BYVAL sBuffer AS STRING, BYVAL StrmFmt AS LONG) AS LONG
LOCAL ES AS EDITSTREAM
ES.dwCookie = VARPTR(sBuffer)
ES.pfnCallback = CODEPTR(REStreamInCB)
FUNCTION = SendMessage(hEd, %EM_STREAMIN, StrmFmt, VARPTR(ES))
END FUNCTION
'------------------/REStreamIn
CALLBACK FUNCTION DlgProc()
STATIC RtfStr, TempStr AS STRING
SELECT CASE AS LONG CBMSG
CASE %WM_INITDIALOG
RtfStr = _
"{\rtf1\ansi\ansicpg1252\deff0\deflang1033"+$CRLF+ _
"{\fonttbl"+$CRLF+ _
"{\f0\fswiss\fcharset0 Arial;}"+$CRLF+ _
"{\f1\froman\fprq2\fcharset0 Times New Roman;}"+$CRLF+ _
"{\f2\fnil\fprq2\fcharset2 Wingdings;}}"+$CRLF+ _
"{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\f0\fs20\par"+$CRLF+ _
"\trowd\trgaph108\trleft-108\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 "+$CRLF+ _
"\trbrdrb\brdrs\brdrw10 \trpaddl108\trpaddr108\trpaddfl3\trpaddfr3"+$CRLF+ _
"\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs "+$CRLF+ _
"\cellx2040\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs "+$CRLF+ _
"\cellx4320\pard\intbl\lang3081\f1\fs24 Cell 1.1\line Multiline?\line Oh Yeah \f2 J\f1\cell "+$CRLF+ _
"Cell 1.2\cell\row\trowd\trgaph108\trleft-108\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 "+$CRLF+ _
"\trbrdrb\brdrs\brdrw10 \trpaddl108\trpaddr108\trpaddfl3\trpaddfr3"+$CRLF+ _
"\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs "+$CRLF+ _
"\cellx2040\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs "+$CRLF+ _
"\cellx4320\pard\intbl Cell 2.1\cell Cell 2.2\cell\row\pard\lang1033\f0\fs20\par"+$CRLF+ _
"}"
DIALOG POST CBHNDL, %WM_USER + 1000, 0, 0
CASE %WM_USER + 1000
'Control Set Text CbHndl, %IDC_RICHEDIT1, RtfStr ' only w/RichEdit ver 1.0!
REStreamIn GetDlgItem(CBHNDL, %IDC_RICHEDIT1), RtfStr, %SF_RTF ' ver 2.0 +
CASE %WM_SYSCOMMAND
IF CBWPARAM AND &H0FFF0 = %SC_CLOSE THEN
DIALOG END CBHNDL
END IF
END SELECT
END FUNCTION
'------------------/DlgProc
FUNCTION PBMAIN()
LOCAL hDlg AS DWORD
'LoadLibrary("RichEd32.dll") ' No good for multiline
LoadLibrary("MSFTEDIT.DLL") ' <-- V4.1
DIALOG NEW 0, "RE 4.1 Test", , , 240, 120, %WS_CAPTION OR %WS_SYSMENU, TO hDlg
'CONTROL ADD "RichEdit", hDlg, %IDC_RICHEDIT1, " ", 5, 5, 230, _ ' use w / Riched32.dll
CONTROL ADD "RichEdit50W", hDlg, %IDC_RICHEDIT1, " ", 5, 5, 230, 90, _ ' <-- V4.1
%WS_CHILD OR %WS_VISIBLE OR %WS_BORDER OR %ES_MULTILINE OR %ES_AUTOVSCROLL OR %ES_WANTRETURN
DIALOG SHOW MODAL hDlg, CALL DlgProc
END FUNCTION
'------------------/PBMain
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: