Hi,
Is there a way to display text in a "textbox like function" that can shift colors/text sizes/bold/etc.
I see "richedit" but cannot seem to find a way to just "add a line"
Example of what I'm trying to do (in as simple a manner as possible)
U1234Injector #1, short to ground
INTERFACE DISCONNECTED (PT:24)
Each time being able to add a "next" line with possibly different text/bold/color/etc
(kind of like how I've done here)
Programmatically of course, think of the box as a "display only" non-user-editable status display
Hello James,
I use a RichEdit control to do something similar.
Hard code RTF commands like this:
' Create RTF header here...
s_accumulate_header += "20:00\par" + CRLF
s_accumulate_header += "20:30\par" + CRLF
s_accumulate_header += "21:00\par" + CRLF
s_accumulate_header += "21:30\par" + CRLF
s_accumulate_header += "\par" + CRLF
s_accumulate_header += "\cf1\ul Notes:\cf0\ulnone\par" + CRLF
s_accumulate_header += "\par" + CRLF
s_accumulate_header += "Use check mark \cf3\f2\fs18\lang1033\'fc\cf0\f1\fs20\lang4105 for completed items (copy/paste).\par" + CRLF
s_accumulate_header += "\par" + CRLF
s_accumulate_header += "}" + CRLF
s_accumulate_header += Chr( 0 )
'' Attempt to create new file
Dim as Long o = Open( t_db.JournalLog For Append as #eFileNum.journaldb )
If o = 0 Then '' Good Open
'' Creates file in RTF format (this header string)
Put #eFileNum.journaldb, 1, s_accumulate_header
Close #eFileNum.journaldb
EndIf
Then load the created file into a richtext control. like so RichEdit_LoadRtfFromFileW( hWnd, some_file_name )
This works for me as I save each file with a specific date for archiving purposes. CRM1.jpg (some lines of code were moved around for aesthetic purposes)
On another project I used separate Labels to create a grid like appearance with different formatting depending on the input data. Emulator...jpg
I'm sure Paul or Jose can point you towards something much more elegant than this, but it works for my needs; maybe yours too.
So every time you "add" text, you have to reload the entire box?
Survived multiple incursions into Euler/Fermat's theorem of roots of relative prime numbers - killed by richedit.
Hello James,
I only create a new file when the date changes. And you may not want to save the data-in to file.
What is your data refresh rate?
In the other example image the refresh rate was typically 250MS so building files at that rate was impractical and labels were the only real option (grids would have been helpful but not necessarily better)
I would go with the "Label" version if you don't want to insert values into an existing RTfile. And the labels can be placed anywhere you need the data displayed.
Refresh rate could be 50ms in some cases as this is a real-time log of sorts. I may just have to forgo the beauty and go with a regular textbox.
You could use gdi flat api
see GdipDrawString windows reference, and powerbasic José Roca examples