Page 1 of 1

Characters from different code tables

PostPosted: Tue Aug 29, 2023 9:11 am
by Natter
Hi,

Is it possible to show text in the xBrowse cell with characters inserted into it from another code table
(for example, superscript characters of space or volume. As in Word/Excel) ?

Re: Characters from different code tables

PostPosted: Tue Aug 29, 2023 9:51 am
by nageswaragunupudi
I can tell you this much.
If the string appears correctly using "?" command, it will appear the same way in XBrowse also.
First, test with
Code: Select all  Expand view
? cText

Re: Characters from different code tables

PostPosted: Tue Aug 29, 2023 12:48 pm
by Natter
Good.
Is it possible to use different fonts in the same row (not in different rows) of the cell ?

Re: Characters from different code tables

PostPosted: Tue Aug 29, 2023 3:23 pm
by nageswaragunupudi
superscript characters of space or volume

Please give some examples and let us try now.
Any character can also be expressed in utf8. Then we can concatenate all utf8 characters

Re: Characters from different code tables

PostPosted: Tue Aug 29, 2023 4:06 pm
by nageswaragunupudi
Please first see the functioning of the function
Code: Select all  Expand view
FW_SayTextHilite( hDC, cText, aRect, oFont, nClrText, nClrBack, aWords )


This is an example how to use:
Code: Select all  Expand view
function TestHilite()

   local oWnd
   local cText := "We always eat dinner together"
   local aWords
   local oFont, oBold, oItalic

   DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-22
   DEFINE FONT oBold NAME "VERDANA" SIZE 0,-25 BOLD
   DEFINE FONT oItalic NAME "TIMES NEW ROMAN" SIZE 0,-25 ITALIC

   aWords   := {  { "ALWAYS", oBold, CLR_HRED, CLR_YELLOW }, ;
                  { "DINNER", oItalic, CLR_GREEN, CLR_HGRAY }, ;
                  { "TOGETHER", oItalic, CLR_WHITE, CLR_RED } }

   DEFINE WINDOW oWnd
   oWnd:SetFont( oFont )

   oWnd:bPainted  := <|hDC|
      local aRect    := GetClientRect( oWnd:hWnd )
      aRect[ 2 ] += 100
      FW_SayTextHilite( hDC, cText, aRect, oFont, ;
            CLR_BLACK, CLR_WHITE, aWords )
      return nil
      >
   ACTIVATE WINDOW oWnd CENTERED

   RELEASE FONTS oFont, oBold, oItalic

return nil


Image

Now you have to use this function to paint text in a cell by defining your own codeblock:
Code: Select all  Expand view
oCol:bPaintText

This codeblock is evaluated like this:
Code: Select all  Expand view
Eval( ::bPaintText, Self, hDC, cStrData, oRect:aRect, aColors, lHighLite, lSelected )

Re: Characters from different code tables

PostPosted: Tue Aug 29, 2023 6:03 pm
by Natter
Thanks! This is what I need