FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FolderEx + TTitle + RTF: TTitle and RTF not working
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
FolderEx + TTitle + RTF: TTitle and RTF not working
Posted: Thu Oct 06, 2022 07:17 AM
Where is my mistake here?
TTitle not displayed correctly and RTF just allow single line. Can't even press Enter
FWH1912 + BCC + HB




How TTitle should have looked


Code (fw): Select all Collapse
#include "fivewin.CH"
#include "ttitle.ch"
#include "RichEdit.ch"

procedure main()
  hr():activate()
return
//----------------------------------------------------------------------
class hr
  data oDlg, oSay, hRtfDll
  data oDbPerson, oFolder
  data hoTitles, hoGets, hGets init {=>}

  method activate()
  method createTitle(oTitle, oFont)
  method refresh()
endclass
//----------------------------------------------------------------------
method activate() class HR
  LOCAL cNotes, oBtnOK, oBtnCnl, oBtnPrn, oSay, oldarea := select()

  LOCAL cTitl := "Title On FolderEx", oFont3, oFnt

  local omfont2 :=TFont():New( "TIMES NEW ROMAN", 0, -24, .F., .f., 0, 1, 650,.T.,,, 0, 3, 2, 1 )

  LOCAL bReturn := < ||
                          oFnt:end()
                          oMFont2:end()
                          oFont3:end()
                   >

  local cGet := "", oTitle, cName, o := self

  DEFINE FONT oFnt NAME "SYSTEM_FIXED_FONT" SIZE 0, -12
  DEFINE FONT oFont3 NAME "Verdana" SIZE 0, -20 bold


  ::hGets["edu_1"] := ""
  ::hGets["edu_2"] := ""
  ::hGets["edu_3"] := ""

  ::hRtfDll := LoadLibrary( "Riched20.dll" )
  DEFINE DIALOG ::oDlg RESOURCE "hr" TITLE cTitl FONT oFnt

    REDEFINE FOLDEREX ::oFolder ID 110 OF ::oDlg   ;
     PROMPT "&Education", "&Others" DIALOGS "hr_edu", "Sub1" BOTTOM

       // sub- folders
       REDEFINE TITLE ::hoTitles["edu_1"] ID 102 of ::oFolder:aDialogs[1] SHADOW BOTTOMRIGHT
       REDEFINE RICHEDIT ::hoGets["edu_1"] VAR ::hGets["edu_1"] ID 301 OF ::oFolder:aDialogs[1]

       REDEFINE TITLE ::hoTitles["edu_2"] ID 104 of ::oFolder:aDialogs[1] SHADOW BOTTOMRIGHT
       REDEFINE RICHEDIT ::hoGets["edu_2"] VAR ::hGets["edu_1"] ID 105 OF ::oFolder:aDialogs[1]

       REDEFINE TITLE ::hoTitles["edu_3"] ID 101 of ::oFolder:aDialogs[1] SHADOW BOTTOMRIGHT
       REDEFINE RICHEDIT ::hoGets["edu_3"] VAR ::hGets["edu_1"] ID 106 OF ::oFolder:aDialogs[1]



       REDEFINE BUTTON oBtnOK ID 111 OF ::oDlg                                          ;
          ACTION (                                                                    ;
                   oBtnCnl:click()                                                    ;
                 )

       REDEFINE BUTTON oBtnCnl ID 112 OF ::oDlg                                     ;
          ACTION (                                                                        ;
                   ::oDlg:End()                                                             ;
                 )                                                                        ;

       REDEFINE BUTTON oBtnPrn ID 113 OF ::oDlg

       ACTIVATE DIALOG ::oDlg CENTERED                                                    ;
          ON INIT (                                                                       ;
                    o:refresh(),                                                          ;
                    o:CreateTitle(o:hoTitles["edu_1"], oFont3, "Formal Education"),       ;
                    o:CreateTitle(o:hoTitles["edu_2"], oFont3, "Tertiary Education"),     ;
                    o:CreateTitle(o:hoTitles["edu_3"], oFont3, "Professional Education")  ;
                  )                                                                       ;

       EVAL( bReturn )
       FreeLibrary( ::hRtfDll )

RETURN (NIL)
//---------------------------------------------------------------------------
method refresh() class HR
/*
  ::varput(trim(::oDbPerson:name)+" ("+ trim(::oDbPerson:empno) + ")")

  ::hoGets["edu_1"]:LoadRtf( ::oDbPerson:rtf_edu1 )
  ::hoGets["edu_2"]:LoadRtf( ::oDbPerson:rtf_edu2 )
  ::hoGets["edu_3"]:LoadRtf( ::oDbPerson:rtf_edu3 )
*/
  ::oDlg:update()
return nil
//----------------------------------------------------------------------
method CreateTitle(  oTitle, oFont, cText ) class HR
/*
    oTitle:=.T.
    oTitle:aGrdBack = { { 1, nRGB( 129, 130, 138 ), nRGB( 59, 60, 62 ) } }
 */
   @ 12, 55 TITLETEXT OF oTitle TEXT cText FONT oFont
*   @ 10, 10 TITLEIMG OF oTitle RESNAME "users" SIZE 30, 30 REFLEX TRANSPARENT

return nil


Code (fw): Select all Collapse
hr DIALOG 45, 30, 434, 393
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 10, "System"
{
 CONTROL "", 110, "TFolderEx", WS_VISIBLE | WS_TABSTOP, 4, 52, 424, 304
 CONTROL "&Ok", 111, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 132, 369, 50, 14
 CONTROL "&Cancel", 112, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 192, 369, 50, 14
 CONTROL "&Print", 113, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 253, 369, 50, 14
}

hr_edu DIALOG 23, 82, 292, 351
STYLE WS_CHILD
{
 CONTROL "Custom control", 102, "TTITLE", WS_CHILD | WS_VISIBLE, 4, 2, 284, 20
 CONTROL "", 301, "RichEdit20A", ES_LEFT | ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 3, 24, 286, 88
 CONTROL "", 105, "RichEdit20A", ES_LEFT | ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 2, 143, 286, 88
 CONTROL "Custom control", 104, "TTITLE", WS_CHILD | WS_VISIBLE, 3, 121, 284, 20
 CONTROL "", 106, "RichEdit20A", ES_LEFT | ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 2, 258, 286, 88
 CONTROL "Custom control", 101, "TTITLE", WS_CHILD | WS_VISIBLE, 3, 236, 284, 20
}

SUB1 DIALOG 23, 82, 292, 167
STYLE WS_CHILD
{
 CONTROL "", 301, "EDIT", ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 3, 2, 286, 162
}
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FolderEx + TTitle + RTF: TTitle and RTF not working
Posted: Thu Oct 06, 2022 02:23 PM

Dear Hua,

In your first three RichEdit controls in the RC you missed to use ES_WANTRETURN

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FolderEx + TTitle + RTF: TTitle and RTF not working
Posted: Thu Oct 06, 2022 03:00 PM
Dear Hua,

This is the rigth way to do it:
Code (fw): Select all Collapse
#include "fivewin.CH"
#include "ttitle.ch"
#include "RichEdit.ch"

procedure main()
  hr():activate()
return
//----------------------------------------------------------------------
class hr
  data oDlg, oSay, hRtfDll
  data oDbPerson, oFolder
  data hoTitles, hoGets, hGets init {=>}

  method activate()
  method refresh()
endclass
//----------------------------------------------------------------------
method activate() class HR
  LOCAL cNotes, oBtnOK, oBtnCnl, oBtnPrn, oSay, oldarea := select()

  LOCAL cTitl := "Title On FolderEx", oFont3, oFnt

  local omfont2 :=TFont():New( "TIMES NEW ROMAN", 0, -24, .F., .f., 0, 1, 650,.T.,,, 0, 3, 2, 1 )

  LOCAL bReturn := { || oFnt:end(), oMFont2:end(), oFont3:end() }

  local cGet := "", oTitle, cName, o := self

  DEFINE FONT oFnt NAME "SYSTEM_FIXED_FONT" SIZE 0, -12
  DEFINE FONT oFont3 NAME "Verdana" SIZE 0, -20 bold


  ::hGets["edu_1"] := ""
  ::hGets["edu_2"] := ""
  ::hGets["edu_3"] := ""

  ::hRtfDll := LoadLibrary( "Riched20.dll" )
  DEFINE DIALOG ::oDlg RESOURCE "hr" TITLE cTitl FONT oFnt

    REDEFINE FOLDEREX ::oFolder ID 110 OF ::oDlg   ;
     PROMPT "&Education", "&Others" DIALOGS "hr_edu", "Sub1" BOTTOM

       // sub- folders
       REDEFINE TITLE ::hoTitles["edu_1"] ID 102 of ::oFolder:aDialogs[1] // SHADOW BOTTOMRIGHT

       REDEFINE RICHEDIT ::hoGets["edu_1"] VAR ::hGets["edu_1"] ID 301 OF ::oFolder:aDialogs[1]

       REDEFINE TITLE ::hoTitles["edu_2"] ID 104 of ::oFolder:aDialogs[1] SHADOW BOTTOMRIGHT
       REDEFINE RICHEDIT ::hoGets["edu_2"] VAR ::hGets["edu_1"] ID 105 OF ::oFolder:aDialogs[1]

       REDEFINE TITLE ::hoTitles["edu_3"] ID 101 of ::oFolder:aDialogs[1] SHADOW BOTTOMRIGHT
       REDEFINE RICHEDIT ::hoGets["edu_3"] VAR ::hGets["edu_1"] ID 106 OF ::oFolder:aDialogs[1]



       REDEFINE BUTTON oBtnOK ID 111 OF ::oDlg                                          ;
          ACTION (                                                                    ;
                   oBtnCnl:click()                                                    ;
                 )

       REDEFINE BUTTON oBtnCnl ID 112 OF ::oDlg                                     ;
          ACTION (                                                                        ;
                   ::oDlg:End()                                                             ;
                 )                                                                        ;

       REDEFINE BUTTON oBtnPrn ID 113 OF ::oDlg

       ACTIVATE DIALOG ::oDlg CENTERED ON INIT ( o:hoTitles[ "edu_1" ]:AddText( 15, 20, "First",,,,, oFont3 ), .T. )                                                 ;
 
       EVAL( bReturn )
       FreeLibrary( ::hRtfDll )

RETURN (NIL)
//---------------------------------------------------------------------------
method refresh() class HR
/*
  ::varput(trim(::oDbPerson:name)+" ("+ trim(::oDbPerson:empno) + ")")

  ::hoGets["edu_1"]:LoadRtf( ::oDbPerson:rtf_edu1 )
  ::hoGets["edu_2"]:LoadRtf( ::oDbPerson:rtf_edu2 )
  ::hoGets["edu_3"]:LoadRtf( ::oDbPerson:rtf_edu3 )
*/
  ::oDlg:update()
return nil
//----------------------------------------------------------------------
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: FolderEx + TTitle + RTF: TTitle and RTF not working
Posted: Mon Oct 10, 2022 05:59 PM
Unfortunately, it didn't work when I tried it Antonio.

Antonio Linares wrote:Dear Hua,

This is the rigth way to do it:
Code (fw): Select all Collapse
       ACTIVATE DIALOG ::oDlg CENTERED ON INIT ( o:hoTitles[ "edu_1" ]:AddText( 15, 20, "First",,,,, oFont3 ), .T. )
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: FolderEx + TTitle + RTF: TTitle and RTF not working
Posted: Tue Oct 11, 2022 05:02 AM
Antonio,
If I use TFolder (SysTabControl32) instead of TFolderEx in my original code, TTitle works fine.
I however wish to use TFolderEx as it has more features. What need to be fix at TFolderEx?

FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: FolderEx + TTitle + RTF: TTitle and RTF not working
Posted: Tue Oct 11, 2022 07:08 AM
hua wrote:Unfortunately, it didn't work when I tried it Antonio.

Antonio Linares wrote:Dear Hua,

This is the rigth way to do it:
Code (fw): Select all Collapse
       ACTIVATE DIALOG ::oDlg CENTERED ON INIT ( o:hoTitles[ "edu_1" ]:AddText( 15, 20, "First",,,,, oFont3 ), .T. )


Dear Hua,

Did you got an error ? Please post a screenshot or tell me the error that you get, thank you
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: FolderEx + TTitle + RTF: TTitle and RTF not working
Posted: Tue Oct 11, 2022 07:37 AM
There was no run-time error Antonio.
Only TTitle controls not correctly painted as the screenshot in my 1st post shows.
My recent post prior to this showed a correctly painted TTitle where it has purple gradient

*** update: Issue resolved by adding line ::aDialogs[1]:lTransparent := .f. ***
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: FolderEx + TTitle + RTF: TTitle and RTF not working
Posted: Tue Oct 11, 2022 08:58 AM
The following works! Thanks Antonio.
Antonio Linares wrote:In your first three RichEdit controls in the RC you missed to use ES_WANTRETURN


How to code so each RichEdit control has its own TBar as shown in this mock up?
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: FolderEx + TTitle + RTF: TTitle and RTF not working
Posted: Wed Oct 12, 2022 02:08 AM
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour

Continue the discussion