|
|
(One intermediate revision by the same user not shown) |
Line 1: |
Line 1: |
| PFC does not contain any support for the RichEdit control. If you want to use it you may consider this code. The code is the implementation of a [[control]].
| | <vp>richEditControl</vp> is now part of PFC |
| <vip>implement richeditControl | |
| inherits userControlSupport
| |
| open core, vpiDomains, gui_native
| |
| | |
| constants
| |
| className = "richeditControl/richeditControl".
| |
| classVersion = "$JustDate: $$Revision: $".
| |
| | |
| clauses
| |
| classInfo(className, classVersion).
| |
| | |
| class facts
| |
| loaded : boolean := false().
| |
| | |
| clauses
| |
| new(Parent):-
| |
| new(),
| |
| setContainer(Parent).
| |
| | |
| clauses
| |
| new():-
| |
| if loaded = false() then
| |
| _ = useDll::load("Msftedit.dll"),
| |
| loaded := true()
| |
| end if,
| |
| userControlSupport::new(),
| |
| generatedInitialize().
| |
| | |
| constants
| |
| wm_user = 1024.
| |
| em_streamIn = wm_user+73.
| |
| em_streamOut = wm_user+74.
| |
| em_setTextEx = wm_user+97.
| |
| | |
| constants
| |
| st_default = 0.
| |
| st_keepundo = 1.
| |
| st_selection = 2.
| |
| st_newchars = 4.
| |
| | |
| constants
| |
| unicode_codepage = 1200.
| |
| | |
| domains
| |
| setTextEx = setTextEx(unsigned Flags, unsigned Codepage).
| |
| | |
| facts
| |
| hwnd : windowHandle := erroneous.
| |
| style : unsigned := ws_visible + ws_vscroll + es_multiline + es_autovscroll.
| |
| % e.g. style = ws_visible + ws_vscroll + es_multiline + es_autovscroll + es_nohidesel + es_readonly,
| |
| | |
| clauses
| |
| show():-
| |
| userControlSupport::show(),
| |
| Style = ws_child + style,
| |
| getClientSize(Width, Height),
| |
| hwnd := createWindowEx(0, "RichEdit50W", "", Style, 0, 0, Width, Height,
| |
| getVpiWindow(), null, mainExe::getCurrentHinstance(), null),
| |
| WParam = uncheckedConvert(unsigned, setTextEx(st_default, unicode_codepage)),
| |
| LParam = uncheckedConvert(integer, getText()),
| |
| _NoChar = vpi::winSendEvent(hwnd, e_Native(em_setTextEx, WParam, LParam)).
| |
| | |
| predicates
| |
| onSize : window::sizeListener.
| |
| clauses
| |
| onSize(_Source):-
| |
| getClientSize(Width, Height), % This is in pixel
| |
| vpi::winMove(hwnd, rct(0, 0, Width, Height)).
| |
| | |
| % This code is maintained automatically, do not update it manually. 21:21:34-2.10.2007
| |
| facts
| |
| | |
| predicates
| |
| generatedInitialize : ().
| |
| clauses
| |
| generatedInitialize():-
| |
| setText("richeditControl"),
| |
| This:setSize(240, 120),
| |
| addSizeListener(onSize).
| |
| % end of automatic code
| |
| end implement richeditControl</vip>
| |
| | |
| | |
| [[Category:Controls]]
| |
| [[Category:Examples]]
| |