by Silvio.Falconi » Sun May 08, 2016 9:52 am
Antonio,
I saw it run ok on Window
when we use a dialog it not run ok
please try this test :
On Window ( run but run bad , before select one line then select the middle on line up and middle of line down)
- Code: Select all Expand view
#include "FiveWin.ch"
#include "constant.ch"
#include "RichEdit.ch"
#define CRLF1 Chr( 10 )
Function test()
local oLbx
local oDlg
local oRtf
local cText:= "Test test test test test test test test test test test test " + CRLF +;
"Test test test test test test test test test test test test" + CRLF +;
"Test test test test test test test test test test test" + CRLF +;
"Test test test test test test test test test test" + CRLF +;
"Test test test test test test test test test " + CRLF +;
"Test test test test test test test test test " + CRLF +;
"Test test test test test test test" + CRLF +;
"Test test test test test test test" + CRLF +;
"Test test test test test test test"
local cText1
local uTemp := If( ! Empty( cText ), cText, "" )
local nBottom_c := 15
local nRight_c := 75
local nWidth_c := Max( nRight_c * DLG_CHARPIX_W, 180 )
local nHeight_c := nBottom_c * DLG_CHARPIX_H
local hDLL
local alevel := {"1","2","3","4","5","6","7","8","9"}
local nlevel := 1
local oFontPreview:=TFont():New( GetSysFont(), -3, 5)
DEFINE WINDOW oDlg FROM 6, 6 TO 37, 71 TITLE "test :"
//oDlg:lTruePixel := .f.
hDLL = LoadLibrary( "Msftedit.dll" ) //"Riched20.dll" ) //
// hDLL = LoadLibrary( "Riched20.dll" ) //"Riched20.dll" )
@ 15, 60 RICHEDIT oRtf VAR uTemp OF oDlg PIXEL SIZE 425, 410 FONT oFontPreview NO SCROLL NOBORDER
@ 15, 10 LISTBOX oLbx VAR nlevel ITEMS alevel OF oDlg size 40, 160 PIXEL ;
ON CHANGE ( SelectLine( nlevel,oRtf ),oRtf:setfocus() )
ACTIVATE WINDOW oDlg CENTER ;
on init oLbx:setfocus()
oFontPreview:End()
if hDLL != nil
FreeLibrary( hDLL )
endif
return nil
//--------------------------------------------------------------------//
//----------------------------------------------------------------------------//
Function SelectLine( nRow,oRtf )
local nCol := oRtf:GetCol()
if !Empty( nRow )
oRtf:GoToLine( nRow - 1 )
endif
DEFAULT nRow := oRtf:GetRow()
nRow := Min( nRow, oRtf:GetLineCount() )
oRtf:SetPos( oRtf:GetPos() - ( nCol - 1 ) )
oRtf:SetSel( oRtf:GetPos(), oRtf:GetPos() + Len( oRtf:GetLine( nRow ) ) ) // - 1
//oRTF:SetFocus()
Return nil
//----------------------------------------------------------------------------//
Dialog - Code: Select all Expand view
#include "FiveWin.ch"
#include "constant.ch"
#include "RichEdit.ch"
#define CRLF1 Chr( 10 )
Function test()
local oLbx
local oDlg
local oRtf
local cText:= "Test test test test test test test test test test test test " + CRLF +;
"Test test test test test test test test test test test test" + CRLF +;
"Test test test test test test test test test test test" + CRLF +;
"Test test test test test test test test test test" + CRLF +;
"Test test test test test test test test test " + CRLF +;
"Test test test test test test test test test " + CRLF +;
"Test test test test test test test" + CRLF +;
"Test test test test test test test" + CRLF +;
"Test test test test test test test"
local cText1
local uTemp := If( ! Empty( cText ), cText, "" )
local nBottom_c := 15
local nRight_c := 75
local nWidth_c := Max( nRight_c * DLG_CHARPIX_W, 180 )
local nHeight_c := nBottom_c * DLG_CHARPIX_H
local hDLL
local alevel := {"1","2","3","4","5","6","7","8","9"}
local nlevel := 1
local oFontPreview:=TFont():New( GetSysFont(), -3, 5)
DEFINE DIALOG oDlg FROM 6, 6 TO 37, 71 TITLE "test :"
//oDlg:lTruePixel := .f.
hDLL = LoadLibrary( "Msftedit.dll" ) //"Riched20.dll" ) //
// hDLL = LoadLibrary( "Riched20.dll" ) //"Riched20.dll" )
@ 15, 60 RICHEDIT oRtf VAR uTemp OF oDlg PIXEL SIZE 425, 410 FONT oFontPreview NO SCROLL NOBORDER
@ 15, 10 LISTBOX oLbx VAR nlevel ITEMS alevel OF oDlg size 40, 160 PIXEL ;
ON CHANGE ( SelectLine( nlevel,oRtf ),oRtf:setfocus() )
ACTIVATE DIALOG oDlg CENTER ;
on init oLbx:setfocus()
oFontPreview:End()
if hDLL != nil
FreeLibrary( hDLL )
endif
return nil
//--------------------------------------------------------------------//
//----------------------------------------------------------------------------//
Function SelectLine( nRow,oRtf )
local nCol := oRtf:GetCol()
if !Empty( nRow )
oRtf:GoToLine( nRow - 1 )
endif
DEFAULT nRow := oRtf:GetRow()
nRow := Min( nRow, oRtf:GetLineCount() )
oRtf:SetPos( oRtf:GetPos() - ( nCol - 1 ) )
oRtf:SetSel( oRtf:GetPos(), oRtf:GetPos() + Len( oRtf:GetLine( nRow ) ) ) // - 1
//oRTF:SetFocus()
Return nil
//----------------------------------------------------------------------------//
we not understood why on Dialog not run !!!!
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com