Need a little help
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by FAKEFACTORY.
Hi,
i'm currently stuck into a problem...
I need a Multiline Editcontrol (RichEdit) with the abbility to completly change the backgroundcolor of this control (not only text-background - the complete control should be colored, like the Purebasic editor).
My goal is to print green text on a black background (simulating an old monocolor-monitor)
Is someone here with a codesnipped, that can i use for this purpose, or ... Fred... how about uploading the Editor-Code? This would be a great source for learning and using.
Registered PureBasic Coder
Hi,
i'm currently stuck into a problem...
I need a Multiline Editcontrol (RichEdit) with the abbility to completly change the backgroundcolor of this control (not only text-background - the complete control should be colored, like the Purebasic editor).
My goal is to print green text on a black background (simulating an old monocolor-monitor)
Is someone here with a codesnipped, that can i use for this purpose, or ... Fred... how about uploading the Editor-Code? This would be a great source for learning and using.
Registered PureBasic Coder
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by El_Choni.
Hi,
If you don't want to use the library, the following line should do what you need:
Bye,
El_Choni
Hi,
If you don't want to use the library, the following line should do what you need:
Code: Select all
SendMessage_(RichControlhWnd, #EM_SETBKGNDCOLOR, 0, BGR value) ;
El_Choni
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by TronDoc.
elecTRONics DOCtor
{registeredPB}P150 32Mb w98/DOS/Linux NO DirX NO IE
could you give a small example? I can't get it to work. JoeCode: Select all
SendMessage_(RichControlhWnd, #EM_SETBKGNDCOLOR, 0, BGR value) ;
elecTRONics DOCtor
{registeredPB}P150 32Mb w98/DOS/Linux NO DirX NO IE
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by El_Choni.
Hi, try this:
UPDATED: added green text and face change, like you needed.
Bye,
Edited by - El_Choni on 24 February 2002 12:48:06
Hi, try this:
UPDATED: added green text and face change, like you needed.
Code: Select all
#RICHEDIT = #WS_CHILD|#WS_VISIBLE|#WS_VSCROLL|#ES_MULTILINE|#ES_AUTOVSCROLL|#ES_NOHIDESEL
#SCF_ALL = 4
#SCF_SELECTION = $0001
#SCF_WORD = $0002
#WINDOW_PARAMETERS = #PB_Window_SystemMenu|#PB_Window_MinimizeGadget
If OpenWindow(0, #CW_USEDEFAULT, #CW_USEDEFAULT, #CW_USEDEFAULT, #CW_USEDEFAULT, #WINDOW_PARAMETERS, "RichEdit example")
If LoadLibrary_("RICHED20.DLL")
RichClass.s = "RichEdit20A"
Else
If LoadLibrary_("RICHED32.DLL")
RichClass.s = "RichEdit"
Else
MessageRequester("Error", "RichEdit Windows library not present.", 0)
End
EndIf
EndIf
hWnd = CreateWindowEx_(#WS_EX_CLIENTEDGE, RichClass, "This will desappear with SetWindowText.", #RICHEDIT, 0, 0, WindowWidth(), WindowHeight(), WindowID(), 0, GetModuleHandle_(0), 0)
If hWnd
ShowWindow_(hWnd, #SW_HIDE) ; hide our changes to the user
SetWindowText_(hWnd, "Hi everybody!")
BGR = 0
SendMessage_(hWnd, #EM_SETBKGNDCOLOR, 0, BGR) ; BGR value = black
cf.CHARFORMAT
cf\cbSize = SizeOf(CHARFORMAT)
Red = 0
Green = 255
Blue = 0
BGR = (Blue*65536)|(Green*256)|Red
cf\crTextColor = BGR ; BGR value = green
FontFace.s = "Courier New"
For t = 0 To Len(FontFace)
cf\szFaceName[t] = Asc(Mid(FontFace, t+1, 1))
Next t
cf\dwMask =#CFM_COLOR|#CFM_FACE
SendMessage_(hWnd, #EM_SETCHARFORMAT, #SCF_ALL, @cf)
ShowWindow_(hWnd, #SW_SHOW) ; now show
SetForegroundWindow_(WindowID())
Repeat
EventID = WaitWindowEvent()
Until EventID = #PB_EventCloseWindow
Else
MessageRequester("Error", "Could not create the RichEdit control.", 0)
End
EndIf
Else
MessageRequester("Error", "Could not create the main window.", 0)
EndIf
End
Edited by - El_Choni on 24 February 2002 12:48:06
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by El_Choni.
You may also, as Paul said, use the RichEdit library, which would save more than 20 lines of code here and seems more human-friendly. But that's up to you. If you need any more help with RichEdit, just ask, I've become quite a RichEdit expert coding the lib
Bye,
El_Choni
You may also, as Paul said, use the RichEdit library, which would save more than 20 lines of code here and seems more human-friendly. But that's up to you. If you need any more help with RichEdit, just ask, I've become quite a RichEdit expert coding the lib
Bye,
El_Choni
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by El_Choni.
It would seem like me asking my cat to help me with the RichEdit library. PureBasic uses a RichEdit control, so Fred must know everything about it, and I think he's been working on RTF support at least since June 2001. But RichEdit has lots of functionalities and issues to watch carefully, and there hasn't been too much postings asking him to add it, so I understand that he tries to fix bugs first and add improvements that people do ask for.
At least, that's what me and my cat think. Bye,
El_Choni
It would seem like me asking my cat to help me with the RichEdit library. PureBasic uses a RichEdit control, so Fred must know everything about it, and I think he's been working on RTF support at least since June 2001. But RichEdit has lots of functionalities and issues to watch carefully, and there hasn't been too much postings asking him to add it, so I understand that he tries to fix bugs first and add improvements that people do ask for.
At least, that's what me and my cat think. Bye,
El_Choni
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm