FolderEx + TTitle + RTF: TTitle and RTF not working

FolderEx + TTitle + RTF: TTitle and RTF not working

Postby hua » Thu Oct 06, 2022 7: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

Image


How TTitle should have looked
Image

Code: Select all  Expand view

#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
/*
  ::oSay: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:lBorder:=.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: Select all  Expand view

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
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: FolderEx + TTitle + RTF: TTitle and RTF not working

Postby Antonio Linares » Thu Oct 06, 2022 2: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FolderEx + TTitle + RTF: TTitle and RTF not working

Postby Antonio Linares » Thu Oct 06, 2022 3:00 pm

Dear Hua,

This is the rigth way to do it:
Code: Select all  Expand view

#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
/*
  ::oSay: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FolderEx + TTitle + RTF: TTitle and RTF not working

Postby hua » Mon Oct 10, 2022 5: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: Select all  Expand view

       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
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: FolderEx + TTitle + RTF: TTitle and RTF not working

Postby hua » Tue Oct 11, 2022 5: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?

Image
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: FolderEx + TTitle + RTF: TTitle and RTF not working

Postby Antonio Linares » Tue Oct 11, 2022 7: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: Select all  Expand view

       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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FolderEx + TTitle + RTF: TTitle and RTF not working

Postby hua » Tue Oct 11, 2022 7: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 ::oFolder:aDialogs[1]:lTransparent := .f. ***
Last edited by hua on Tue Oct 11, 2022 9:51 am, edited 1 time in total.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: FolderEx + TTitle + RTF: TTitle and RTF not working

Postby hua » Tue Oct 11, 2022 8: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?
Image
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: FolderEx + TTitle + RTF: TTitle and RTF not working

Postby hua » Wed Oct 12, 2022 2:08 am

FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 109 guests