11-19-2014, 05:14 PM
When I use your last example code and add a button "load b.rtf into rich edit" and use that button to load the rtf into the rich edit, it shows RTF markup. I use File >> New >> Dialog >> Smart dialog (use: #sub DlgProc.) and paste the example code over the existing generated code, and then adjust it. The slightly adjusted code is as follows (with load rtf button):
Function re_test
I have another project that uses listbox to get the textpath and it is a smart dialog, that does not use #sub DlgProc.
It has a similair setup that loads .rtf into the rich edit and it works perfectly.
It is a huge project (at least for me), pasting the whole code would lead to confusion. That's why I pasted parts of it:
The moment the user focuses on a listbox item that is an .rtf file, it executes this function and it works.
QM: 2.4.1.5, portable
Windows 7 64bit
Function re_test
\Dialog_Editor
str dd=
;BEGIN DIALOG
;1 "" 0x90C80AC8 0x0 0 0 282 168 "Dialog"
;3 RichEdit20W 0x54233044 0x200 0 0 284 110 ""
;4 Button 0x54032000 0x0 116 135 99 21 "load b.rtf into rich edit"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040105 "*" "" "" ""
str controls = "3"
str rew3
;;rew3="&$desktop$\b.rtf"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4
,,str rtf_path="$desktop$\b.rtf"
,,_s.getfile(rtf_path)
,,_s.setwintext(id(3 hDlg))
,case IDOK
,case IDCANCEL
ret 1
I have another project that uses listbox to get the textpath and it is a smart dialog, that does not use #sub DlgProc.
It has a similair setup that loads .rtf into the rich edit and it works perfectly.
It is a huge project (at least for me), pasting the whole code would lead to confusion. That's why I pasted parts of it:
BEGIN DIALOG
0 "" 0x90CA0AC8 0x0 0 0 834 387 "Snippet Manager" "2 50"
....
4 RichEdit20A 0x54333044 0x200 175 44 656 253 ""
...
END DIALOG
DIALOG EDITOR: "" 0x2040105 "" "0" "" ""
The moment the user focuses on a listbox item that is an .rtf file, it executes this function and it works.
/snippetmanager_init
function int'hDlg str&right_pane_content
str- current_selected_item_path
int i j k
str- snippets_root
str- root_limit
str- root_limit_folder
right_pane_content.setwintext(id(4 hDlg))
QM: 2.4.1.5, portable
Windows 7 64bit