To Mister Nages - xBrowser

oliveiros junior
Posts: 84
Joined: Tue Mar 20, 2007 3:13 pm

To Mister Nages - xBrowser

Post by oliveiros junior »

Dear Mr. Nages,

I need your help on two situations:

1) In a row, within a column of xBrowse and possible, in a sentence put a word in bold?

Sample: "Teste de mensagem para xbrowser"

2) Would it be possible to put an image in a column and write about that image at run time?

Thank you for your help.

Oliveiros Junior
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: To Mister Nages - xBrowser

Post by nageswaragunupudi »

1) In a row, within a column of xBrowse and possible, in a sentence put a word in bold?

Sample: "Teste de mensagem para xbrowser"
Sample program

Code: Select all

#include "fivewin.ch

//----------------------------------------------------------------------------//

function XbrHilite

   local oDlg, oBrw, oFont, oBold
   local cWordHL  := PadR( "ONE", 10 )
   local aData := ;
      {  { 1, "One day" }          ;
      ,  { 2, "Good one" }         ;
      ,  { 3, "There is none" }    ;
      ,  { 4, "This is clone" }    ;
      ,  { 5, "This one is good" } ;
      }

   DEFINE FONT oFont NAME "TAHOMA"  SIZE 0,-16
   DEFINE FONT oBold NAME "VERDANA" SIZE 0,-16 BOLD UNDERLINE

   DEFINE DIALOG oDlg SIZE 500,250 PIXEL TRUEPIXEL FONT oFont

   @ 20,20 GET cWordHL SIZE 200,28 PIXEL OF oDlg VALID ( oBrw:Refresh(), .t. )

   @ 55,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg DATASOURCE aData AUTOCOLS ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :nStretchCol   := 2
      :aCols[ 2 ]:bPaintText := <|oCol, hDC, cText, aRect, aColors|
         FW_SayTextHilite( hDC, cText, aRect, oFont, aColors[ 1 ], aColors[ 2 ], ;
            { { AllTrim( cWordHL ), oBold, CLR_HRED, CLR_HGREEN } } )
         return nil
         >

      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont, oBold

return nil

//----------------------------------------------------------------------------//
Image
Image
Regards

G. N. Rao.
Hyderabad, India
oliveiros junior
Posts: 84
Joined: Tue Mar 20, 2007 3:13 pm

Re: To Mister Nages - xBrowser

Post by oliveiros junior »

Mr. Nages, thank you.

That's exactly what I was looking for.

Oliveiros Junior
oliveiros junior
Posts: 84
Joined: Tue Mar 20, 2007 3:13 pm

Re: To Mister Nages - xBrowser

Post by oliveiros junior »

Mr. Nages,

I ask if it would be possible at runtime to fill the array with the words for highlighting?

Att.,

Oliveiros Junkor
oliveiros junior
Posts: 84
Joined: Tue Mar 20, 2007 3:13 pm

Re: To Mister Nages - xBrowser

Post by oliveiros junior »

Mr. Nages,

Another thing, when using FW_SayTextHilite in multilines he doesn't respect the line break, he writes everything in succession.

Ex: Linha1
Linha2

After FW_SayTextHilite

Linha1Linha2

Att.,

Oliveiros Junior
oliveiros junior
Posts: 84
Joined: Tue Mar 20, 2007 3:13 pm

Re: To Mister Nages - xBrowser

Post by oliveiros junior »

Mr. Nages,

just one more thing: if we put an image in the bottom of the browser, when the word in hilite is at the beginning of the sentence it shows well, but if it is in the middle of the sentence, it puts a white background, not respecting the image of the.

Att.,

Oliveiros Junior
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: To Mister Nages - xBrowser

Post by nageswaragunupudi »

oliveiros junior wrote:Mr. Nages,

I ask if it would be possible at runtime to fill the array with the words for highlighting?

Att.,

Oliveiros Junkor
Yes.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: To Mister Nages - xBrowser

Post by nageswaragunupudi »

oliveiros junior wrote:Mr. Nages,

Another thing, when using FW_SayTextHilite in multilines he doesn't respect the line break, he writes everything in succession.

Ex: Linha1
Linha2

After FW_SayTextHilite

Linha1Linha2

Att.,

Oliveiros Junior
Yes. This works for single line only.
If we want for multiline, we have to split the lines and write each line one after the other.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: To Mister Nages - xBrowser

Post by nageswaragunupudi »

oliveiros junior wrote:Mr. Nages,

just one more thing: if we put an image in the bottom of the browser, when the word in hilite is at the beginning of the sentence it shows well, but if it is in the middle of the sentence, it puts a white background, not respecting the image of the.

Att.,

Oliveiros Junior
Image in the cell?
Can you post relevant portion of your code and screen-shot if possible?
Regards

G. N. Rao.
Hyderabad, India
oliveiros junior
Posts: 84
Joined: Tue Mar 20, 2007 3:13 pm

Re: To Mister Nages - xBrowser

Post by oliveiros junior »

Thank you mister nages,

1) how would this refresh occur?

WITH OBJECT :aCols[ 3 ]
:bPaintText := <|oCol, hDC, cText, aRect, aColors|
FW_SayTextHilite( hDC, cText, aRect, oFonte_Browse, aColors[ 1 ], aColors[ 2 ], ;
{ aHilite } )
Return NIL
>
END

There are two browsers when the first line changes the second updates, then the words to be highlighted change.
Step to function that selects from the data the array aHilite that filled according to the first. What bed would you give to renew bPaintText?
I've tried refresh(), Eval(bPaintText) and none worked.

2) Does the FW_SayTextHilite function not multiline automatically?

no FW_SayTextHilite
Image

with FW_SayTextHilite
Image


3) Here's picture:

Image
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: To Mister Nages - xBrowser

Post by nageswaragunupudi »

You keep aHilite as static variable.
Fill the array with { { <word>, oFont, [nTxtClr],[nBkClr] } }
Then call oBrw:Refresh()
Regards

G. N. Rao.
Hyderabad, India
oliveiros junior
Posts: 84
Joined: Tue Mar 20, 2007 3:13 pm

Re: To Mister Nages - xBrowser

Post by oliveiros junior »

Dear Mr. Nages,

thank you aHilite has worked.

How to keep the background image of the browser when using DrawTextEx.

Look at the bottom of the word "Teste"

Att.,

Oliveiros Junior

Image
oliveiros junior
Posts: 84
Joined: Tue Mar 20, 2007 3:13 pm

Re: To Mister Nages - xBrowser

Post by oliveiros junior »

WITH OBJECT aBrowser[2]
WITH OBJECT :aCols[ 1 ]
:cHeader := ""
:oHeaderFont := oFonte_padrao
:nHeadStrAlign := AL_CENTER
:nWidth := 80
:bStrData := { || AllTrim( DToC( oMensagem:getValueByPos( 2 ) ) ) }
:nDataStrAlign := AL_TOP
:nCellheight := 20
:oDataFont := oFonte_botao
:SetColsAsRows( { 1, 2 } )
END

WITH OBJECT :aCols[ 2 ]
:cHeader := ""
:oHeaderFont := oFonte_padrao
:nHeadStrAlign := AL_CENTER
:nWidth := 10
:bStrData := { || oMensagem:getValueByPos( 3 ) }
:nCellheight := 25
:nDataStrAlign := AL_TOP
END

WITH OBJECT :aCols[ 3 ]
:cHeader := ""
:oHeaderFont := oFonte_padrao
:nHeadStrAlign := AL_CENTER
:nWidth := 250
:bStrData := { || oMensagem:getValueByPos( 13 ) }
:oDataFont := oFonte_browse
:nDataStrAlign := AL_TOP
:blDClickData := { || HTMLPOP( GetActiveWindow(), nil, 0x000E, RTrim( oMensagem:getValueByPos( 13 ) ) ) }

:bPaintText := <|oCol, hDC, cText, aRect, aColors|
FW_SayTextHilite( hDC, cText, aRect, oFonte_Browse, aColors[ 1 ], aColors[ 2 ], ;
aHilite, oCol )
Return NIL
>
END

:nMarqueeStyle := MARQSTYLE_HIGHLROW
:nColDividerStyle := LINESTYLE_NOLINES
:nRowDividerStyle := LINESTYLE_NOLINES
:lColDividerComplete := .F.
:lUpdate := .T.

:lRecordSelector := .F.
:lHeader := .F.
:lHScroll := .F.

:nHeaderHeight := 30
:nRowHeight := 85
:bClrHeader := { || { CLR_BLACK, CLR_WHITE } }
:bClrGrad := { || { CLR_WHITE, CLR_WHITE } }
:lDrawBorder := .T.
:nStretchCol := STRETCHCOL_WIDEST
:bClrSel := { || { CLR_BLACK, nRGB( 235, 235, 235 ) } }
:bClrSelFocus := { || { CLR_BLACK, nRGB( 235, 235, 235 ) } }
:SetBackGround( cLocal_sistema + '\imagens\fundo.bmp', BCK_FILL )
END
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: To Mister Nages - xBrowser

Post by nageswaragunupudi »

You keep aHilite as static variable.
Fill the array with { { <word>, oFont, [nTxtClr],[nBkClr] } }
Then call oBrw:Refresh()
In the aHilite array, keep [nBkClr] as nil.
Regards

G. N. Rao.
Hyderabad, India
oliveiros junior
Posts: 84
Joined: Tue Mar 20, 2007 3:13 pm

Re: To Mister Nages - xBrowser

Post by oliveiros junior »

Mister Nages,
Did not work.

Aadd (aHilite, {Upper (SubStr (cMessage, start), (endFinal - start) + 1)),;
oFonte_Botao, nil, nil})

Image
Att.,

Oliveiros Junior
Post Reply