Problem with Preview from trichedit RESOLVED

Problem with Preview from trichedit RESOLVED

Postby Silvio.Falconi » Tue Apr 26, 2016 11:37 am

Dear Antonio, on my class mypad I use two methods to return me the active window child and the richedit control

Code: Select all  Expand view
METHOD WndActive() INLINE ( ::oWndMain:oWndActive != NIL )

and
Code: Select all  Expand view
METHOD WndChild() CLASS TMYPAD

   LOCAL oWnd

   #ifndef __XPP__
      oWnd := ::oWndMain:oWndActive:oControl
   #else
      oWnd := ::oWndMain:oWndActive:TMdiChild:oControl
   #endif

RETURN oWnd



when I show the preview of the window child ( ::WndChild():preview() )
I use this button from bar

DEFINE BUTTON RESOURCE "RTFPreview" OF ::oBar1 ;
MESSAGE "Displays full pages" ;
TOOLTIP "Print Preview" NOBORDER ;
WHEN ( ::WndActive() .and. ::WndChild():Len() > 0 ) ;
ACTION ::WndChild():Preview( ::oWndMain )

it make error

Application
===========
Path and name: F:\VERSIONI_RTFPAD\FivePad\FivePad.Exe (32 bits)
Size: 3,452,416 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20150603)
FiveWin Version: FWHX 16.03
Windows version: 6.1, Build 7600

Time from start: 0 hours 0 mins 8 secs
Error occurred at: 26/04/16, 13:20:36
Error description: Error BASE/1004 Class: 'NIL' has no exported method: LEN
Args:
[ 1] = U

Stack Calls
===========
Called from: => LEN( 0 )
Called from: Source\TFivePad.prg => (b)TFIVEPAD:SETBAR( 960 )


on cuurent trichedit I saw this method METHOD Len() INLINE RELen( ::hWnd )

I think make error because the function ::WndChild() return the ocontrol on tmdiclild and when I open the rpreview window it found many controls into
how I can resolve it ?

if I rename the command

DEFINE BUTTON RESOURCE "RTFPreview" OF ::oBar1 ;
MESSAGE "Displays full pages" ;
TOOLTIP "Print Preview" NOBORDER ;
WHEN ( ::WndActive() ) ; // .and. ::WndChild():Len() > 0 );
ACTION ::WndChild():Preview( ::oWndMain )


the rpreview is opened and then make another error

Error description: Error BASE/1004 Class: 'NIL' has no exported method: CANCUT

Code: Select all  Expand view
Application
===========
   Path and name: F:\VERSIONI_RTFPAD\FivePad\FivePad.Exe (32 bits)
   Size: 3,452,416 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20150603)
   FiveWin  Version: FWHX 16.03
   Windows version: 6.1, Build 7600

   Time from start: 0 hours 0 mins 3 secs
   Error occurred at: 26/04/16, 13:35:54
   Error description: Error BASE/1004  Class: 'NIL' has no exported method: CANCUT
   Args:
     [   1] = U  

Stack Calls
===========
   Called from:  => CANCUT( 0 )
   Called from: Source\TFivePad.prg => (b)TFIVEPAD:SETBAR( 975 )

 



on these lines of setbar method

METHOD SetBar() CLASS Tmypad
LOCAL oBar, oCursor, oClp

DEFINE CURSOR oCursor HAND

DEFINE CLIPBOARD oClp OF ::oWndMain FORMAT TEXT

DEFINE BUTTONBAR oBar OF ::oWndMain 3D SIZE 26, 84

oBar:bLClicked := { || NIL }
oBar:bRClicked := { || NIL }

@ -1, -1 BUTTONBAR ::oBar1 OF oBar 3D SIZE oBar:nWidth - 1, 29 ;
BUTTONSIZE 26, 27


DEFINE BUTTON RESOURCE "RTFCut" OF ::oBar1 GROUP ;
MESSAGE "Cuts the selection and puts it on the Clipboard" ;
TOOLTIP "Cut" NOBORDER ;
WHEN ( ::WndActive() .and. ::WndChild:CanCut() ) ; <------------------
ACTION ( ::WndChild():Cut(), ::WndChild():SetFocus() )

DEFINE BUTTON RESOURCE "RTFCopy" OF ::oBar1 ;
MESSAGE "Copies the selection and puts it on the Clipboard" ;
TOOLTIP "Copy" NOBORDER ;
WHEN ( ::WndActive() .and. ::WndChild():CanCopy() ) ;
ACTION ( ::WndChild():Copy(), ::WndChild():SetFocus() )

DEFINE BUTTON RESOURCE "RTFPaste" OF ::oBar1 ;
MESSAGE "Inserts Clipboard contents" ;
TOOLTIP "Paste" NOBORDER ;
WHEN ( ::WndActive() .and. ::WndChild:CanPaste() ) ;
ACTION ( ::WndChild():Paste(), ::WndChild():SetFocus() )

DEFINE BUTTON RESOURCE "RTFUndo" OF ::oBar1 GROUP ;
MESSAGE "Reverses the last action" ;
TOOLTIP "Undo" NOBORDER ;
WHEN ( ::WndActive() .and. ::WndChild():CanUndo() ) ;
ACTION ( ::WndChild:Undo(), ::WndChild():SetFocus() )

DEFINE BUTTON RESOURCE "RTFRedo" OF ::oBar1 ;
MESSAGE "Carries out the previously undone action" ;
TOOLTIP "Redo" NOBORDER ;
WHEN ( ::WndActive() .and. ::WndChild():CanRedo() ) ;
ACTION ( ::WndChild():Redo(), ::WndChild():SetFocus() )




why ?
I tried to modify it as

METHOD WndChild() CLASS TMypad

LOCAL oWnd

#ifndef __XPP__
oWnd := ::oWndMain:oWndActive:oControl
#else
oWnd := ::oWndMain:oWndActive:TMdiChild:oControl
#endif

if oWnd:ClassName() == "TRichEdit"
RETURN oWnd
endif

return nil

but not run ok
thanks
Last edited by Silvio.Falconi on Wed Apr 27, 2016 1:53 pm, edited 1 time in total.
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
User avatar
Silvio.Falconi
 
Posts: 7042
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with Preview from trichedit

Postby Antonio Linares » Tue Apr 26, 2016 6:23 pm

Silvio,

Please provide a small and self contained example to reproduce here
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42073
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problem with Preview from trichedit

Postby Silvio.Falconi » Wed Apr 27, 2016 8:24 am

..
Last edited by Silvio.Falconi on Fri Jun 24, 2016 8:39 am, edited 1 time in total.
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
User avatar
Silvio.Falconi
 
Posts: 7042
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with Preview from trichedit

Postby Antonio Linares » Wed Apr 27, 2016 8:58 am

DEFINE BUTTON RESOURCE "Cut" OF ::oBar1 ;
MESSAGE "Cuts the selection and puts it on the Clipboard" ;
TOOLTIP "Cut" NOBORDER ;
WHEN ( ::WndActive() .and. ::WndChild() != nil .and. ::WndChild:CanCut() ) ;
ACTION ( ::WndChild():Cut(), ::WndChild():SetFocus() )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42073
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problem with Preview from trichedit

Postby Silvio.Falconi » Wed Apr 27, 2016 9:40 am

GREAT

Image
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
User avatar
Silvio.Falconi
 
Posts: 7042
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], RSalazarU and 41 guests