How to code multiple RTF controls on a dialog with each having its own bar?
TIA
ACTIVATE DIALOG ::oDlg CENTERED ;
ON INIT ( o:hoTitles[ "edu_1" ]:AddText( 15, 20, "First",,,,, oFont3 ),;
o:hoGets["edu_1"]:oBar:Move( 0, 0 ), o:hoGets["edu_1"]:oBar:Show(), o:hoGets["edu_1"]:lBar := .F., .T. )
DATA bBuildBar
::bBuildBar := { || BuildRichEditBar( Self, Self, , , .T. ) }
if ::lBar
::oBar := XEval( ::bBuildBar, ::oWnd, Self ) // BuildRichEditBar( Self, Self, , , .T. )
//::oTop := ::oBar
::oBar:Hide()
endif
::bBuildBar := { || BuildRichEditBar( Self, Self, , , .T. ) }
if ::lBar
::bInit := { || ::oBar := XEval( ::bBuildBar, ::oWnd, Self ), ::oBar:Hide() }
endif
cnavarro wrote:I don't know if I understood your problem correctly
Do you mean that you can customize the buttonbar of each RICHEDIT control?
Please put the code of the program in the image above to be able to work on it.
#include "fivewin.CH"
#include "ttitle.ch"
#include "RichEdi5.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
::oFolder:aDialogs[1]:lTransparent := .f.
::oFolder:aDialogs[2]:lTransparent := .f.
// sub- folders
REDEFINE TITLE ::hoTitles["edu_1"] ID 102 of ::oFolder:aDialogs[1] SHADOW BOTTOMRIGHT
REDEFINE RICHEDIT5 ::hoGets["edu_1"] VAR ::hGets["edu_1"] ID 301 OF ::oFolder:aDialogs[1] BARBUTTON
REDEFINE TITLE ::hoTitles["edu_2"] ID 104 of ::oFolder:aDialogs[1] SHADOW BOTTOMRIGHT
REDEFINE RICHEDIT5 ::hoGets["edu_2"] VAR ::hGets["edu_1"] ID 105 OF ::oFolder:aDialogs[1] BARBUTTON
REDEFINE TITLE ::hoTitles["edu_3"] ID 101 of ::oFolder:aDialogs[1] SHADOW BOTTOMRIGHT
REDEFINE RICHEDIT5 ::hoGets["edu_3"] VAR ::hGets["edu_1"] ID 106 OF ::oFolder:aDialogs[1] BARBUTTON
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
@ 2, 55 TITLETEXT OF oTitle TEXT cText FONT oFont
* @ 10, 10 TITLEIMG OF oTitle RESNAME "users" SIZE 30, 30 REFLEX TRANSPARENT
return nil
//---------------------------------------------------------------------------
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, "RichEdit50W", ES_LEFT | ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP | ES_WANTRETURN, 3, 24, 286, 88
CONTROL "", 105, "RichEdit50W", ES_LEFT | ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP | ES_WANTRETURN, 2, 143, 286, 88
CONTROL "Custom control", 104, "TTITLE", WS_CHILD | WS_VISIBLE, 3, 121, 284, 20
CONTROL "", 106, "RichEdit50W", ES_LEFT | ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP | ES_WANTRETURN, 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
}
Antonio Linares wrote:Dear Hua,
If I properly understood you, you have to do the following:
1. use "RichEdi5.ch" instead of "RichEdit.ch"
...
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 95 guests