Richedit on a dialog

Richedit on a dialog

Postby Silvio.Falconi » Sun Apr 17, 2016 8:41 pm

I must insert richedit in a my dialog
Ho I can make to insert buttonbar up the RICHEDIT control
is there a possibility to create a buttonbar at x,y coordinates ?

Image


static Function ModelliEmail()
Local nBottom := 29.2
Local nRight := 58
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
Local aget[3],hDll

USE MAILMOD ALIAS MM

DEFINE DIALOG oDlgModelli ;
SIZE nWidth, nHeight PIXEL TRUEPIXEL ;
TITLE cDlgTitle
...
hDLL = LoadLibrary( 'riched20.dll' )
@ 90,110 RICHEDIT aGet[3] VAR MM->MESSAGE of oDlgModelli PIXEL SIZE 100,100



,,,
ACTIVATE DIALOG oDlgModelli centered ;
on init BuildRichEditBar( oDlgModelli, aGet[3] )
//....................................................................................................//

static function BuildRichEditBar( oWnd, oRtf )

local oBar, oBtn, oBullet, oBold, oItalic, oNumber, oUnderline, oCursor
local lBold := .F., lItalic := .F., lUnderline := .F., lBullet := .F.,;
lNumber := .F.

DEFINE CURSOR oCursor HAND

@ 90,110 BUTTONBAR oBar OF oWnd BUTTONSIZE 26, 27


return nil




it make error
Code: Select all  Expand view  RUN
[code]Application
===========
   Path and name: F:\Versioni_Invio_Mail\Mail\ut_mail.Exe (32 bits)
   Size: 3,443,200 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 5 secs
   Error occurred at: 04/17/16, 23:02:15
   Error description: Error BASE/1081  Argument error: +
   Args:
     [   1] = N   110
     [   2] = U  

Stack Calls
===========
   Called from: .\source\classes\BAR.PRG => TBAR:NEWAT( 349 )
   Called from: source\ut_mail.prg => BUILDRICHEDITBAR( 1066 )
   Called from: source\ut_mail.prg => (b)MODELLIEMAIL( 1045 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:INITIATE( 699 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 889 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 293 )
   Called from: source\ut_mail.prg => MODELLIEMAIL( 1045 )
   Called from: source\ut_mail.prg => (b)SHOWMAILPOPUP( 475 )
   Called from: .\source\classes\MENU.PRG => TMENU:ACTIVATE( 1104 )
   Called from: source\ut_mail.prg => SHOWMAILPOPUP( 482 )
   Called from: source\ut_mail.prg => (b)TEST( 45 )[/code]
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: 7068
Joined: Thu Oct 18, 2012 7:17 pm

Re: Richedit on a dialog

Postby James Bott » Mon Apr 18, 2016 3:18 pm

Silvio and Antonio,

There seems to be an error in the FWH buttonbar code. In BAR.PRG line 349 (FWH 16.02) nWidth is used but it is never defined. nHeight is set to a default but not nWidth.

I have never seen the "@ nRow,nCol BUTTONBAR..." syntax before so presumably this is new syntax and perhaps it was not completed?

This code errors out:

Code: Select all  Expand view  RUN
#include "fivewin.ch"

Function Main()
   Local oDlg
   
   define dialog oDlg
   
   activate dialog oDlg on init buildBar(oDlg)

Return nil

Function BuildBar(oDlg)
   @ 5,5 buttonbar oBar of oDlg
return nil
 


James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Richedit on a dialog

Postby Antonio Linares » Mon Apr 18, 2016 3:48 pm

There is no a @ ..., ... BUTTONBAR as traditionally the buttonbar is placed at top, left, bottom, right

This is an example to do what Silvio wants:

Code: Select all  Expand view  RUN
#include "FiveWin.ch"

function Main()

   local oDlg, oBar

   DEFINE DIALOG oDlg SIZE 400, 300

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT BuildButtonBar( oDlg )

return nil

function BuildButtonBar( oDlg )

   local oBar

   DEFINE BUTTONBAR oBar OF oDlg 2013

   DEFINE BUTTON OF oBar ACTION MsgInfo( "ok" )

   oDlg:oTop = nil
   oDlg:oBar = nil

   oBar:SetPos( 50, 150 )
   oBar:nWidth = 200

return nil
   
regards, saludos

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

Re: Richedit on a dialog

Postby Enrico Maria Giordano » Mon Apr 18, 2016 9:27 pm

Antonio Linares wrote:There is no a @ ..., ... BUTTONBAR


Sure there is! :-)

Code: Select all  Expand view  RUN
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd

    LOCAL oBar

    DEFINE WINDOW oWnd

    DEFINE BUTTONBAR OF oWnd 2007;
           SIZE 33, 33

    DEFINE BUTTON OF oWnd:oBar;
           FILE "C:\FWH\BITMAPS\OPEN.BMP";
           ACTION MSGINFO( "First bar Ok!" );
           TOOLTIP "This is a test"

    @ 33, -1 BUTTONBAR oBar OF oWnd;
             SIZE 1602, 36;
             BUTTONSIZE 60, 33

    oBar:l2007 = .T.

    DEFINE BUTTON OF oBar;
           FILE "C:\FWH\BITMAPS\SAVE.BMP";
           ACTION MSGINFO( "Second bar Ok!" )

    ACTIVATE WINDOW oWnd

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Richedit on a dialog

Postby James Bott » Mon Apr 18, 2016 11:58 pm

Antonio,

The @..buttonbar syntax is defined in Fivewin.ch, line 226.

Enrico,

I don't know why your example is working and mine isn't. Perhaps because of the "l2007:=.t."?

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Richedit on a dialog

Postby James Bott » Tue Apr 19, 2016 1:19 am

Everyone,

Ok, I have proven my suspicion. You must specify the SIZE of the buttonbar when using the @ nRow, nCol syntax, or the compiler will error out.

This code works.

Code: Select all  Expand view  RUN
#include "fivewin.ch"

Function Main()
   Local oDlg
   define dialog oDlg
   activate dialog oDlg on init buildBar(oDlg)
Return nil

Function BuildBar(oDlg)
   Local oBar
   @ 20,30 buttonbar oBar SIZE oDlg:nWidth, 29 of oDlg pixel
   define button of oBar
return nil


So the fix is to define a default value for nWidth in the TBar:NewAt() method. Note that nHeight is defalted but nWidth is not. I am not exactly sure what it should default to. The width is supposedly the distance from the starting point on oWnd (or oDlg) to the right edge of the oWnd, but this distance is unknown and may change when the parent is resized.

When (or if) nWidth has a default value, then you will not need to use the SIZE clause.

The problem with just leaving it, is that the programmer gets a very cryptic error that is difficult to figure out. Even if nWidth has an unusable default value, at least the program won't crash and the problem will be visible which will force the programmer to use the SIZE clause.

IMHO.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Richedit on a dialog

Postby Antonio Linares » Tue Apr 19, 2016 6:26 am

thank you, I forgot it :-)
regards, saludos

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

Re: Richedit on a dialog

Postby Silvio.Falconi » Tue Apr 19, 2016 10:32 am

thanks antonio and Enrico...
I saw the fivewin.ch and before I tried to use Newat method
perhaps I make wrong any parameter and then it crashed...
this aftrnoon I must insert it on my aplication anf I try ... but I 'm sure it run ok ...
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: 7068
Joined: Thu Oct 18, 2012 7:17 pm

Re: Richedit on a dialog

Postby Silvio.Falconi » Wed Apr 20, 2016 8:06 am

I tried and run but I have problems
Image


I use a Dialog and not a Window

I use a Dialog style WS_OVERLAPPED

oDlgModelli:nStyle := nOr( WS_OVERLAPPED,WS_THICKFRAME,WS_SYSMENU,WS_MAXIMIZEBOX, 0 )

then I resize all controls of the dialog into a function :

oDlgModelli:bResized := {||Rinfresca_oDlgModelli(oTitle,oImagetitle,oDlgModelli,oLbx,oSay,aGet ,oBarMemo) }

ACTIVATE DIALOG oDlgModelli centered ;
ON INIT BuildRichEditBar( oDlgModelli, aGet[3],oBarMemo )

return nil

//--------------------------------------------------------------------------------------------------------------------------//
static function BuildRichEditBar( oWnd, oRtf, oBarMemo )

local oBtn, oBullet, oBold, oItalic, oNumber, oUnderline, oCursor
local lBold := .F., ;
lItalic := .F., ;
lUnderline := .F.,;
lBullet := .F.,;
lNumber := .F.



DEFINE CURSOR oCursor HAND


@ oRtf:nTop,oRtf:nLeft BUTTONBAR oBarMemo ;
SIZE oRtf:nWidth+100,27 3D;
BUTTONSIZE 26, 27;
OF oWnd ;
CURSOR oCursor

DEFINE BUTTON oBtn OF oBarMemo ;
MESSAGE "Create a new file" TOOLTIP "New" NOBORDER ;
ACTION oRTF:SetText( "" )

oBtn:hBitmap1 = FWBitmap( "new16" )
...
return nil
//--------------------------------------------------------------------------------------------------//


static Function Rinfresca_oDlgModelli(oTitle,oImagetitle,oDlg,oLbx,oSay,aGet,oBarMemo )
Local aClient := GetClientRect ( oDlg:hWnd )

IF oBarMemo != NIL

oBarMemo:nTop := aGet[3]:nTop-30
oBarMemo:nRight := aClient[ 4 ] - aGet[3]:nLeft-10
oBarMemo:nleft := aGet[3]:nLeft

oBarMemo:setpos(aGet[3]:nTop-30,aGet[3]:nLeft )
oBarMemo:Refresh()
endif
return nil


//--------------------------------------------------------------------------------------------------------------//

when I resize the bar is allway at same point and not refresh and I wish erase the border of the bar
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: 7068
Joined: Thu Oct 18, 2012 7:17 pm

Re: Richedit on a dialog

Postby Antonio Linares » Wed Apr 20, 2016 8:46 am

Silvio,

Please provide a small and self contained example.

I can not copy and build your posted code.

thanks,
regards, saludos

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

Re: Richedit on a dialog

Postby Silvio.Falconi » Wed Apr 20, 2016 9:08 am

Code: Select all  Expand view  RUN
#include "Fivewin.ch"
#include "constant.ch"
#include "ttitle.ch"
#include "richedit.ch"


#define  LIGHTCYAN    nRGB( 203, 225, 252 )


REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO

Function Test()

   Local  nBottom   := 29.2
   Local  nRight    :=  58
   Local  nWidth    :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local  nHeight   :=  nBottom * DLG_CHARPIX_H


    Local cDlgTitle  :="Family"



    Local oDlgModelli,oBarMemo
   Local aGet[5],oSay[2]
   Local oFontmodelli,oFontBoldModelli

   Local oLbx
   Local cMessage := space(200)
   Local cSubject := space(60)
   Local cModello := space(60)

       Local oImagetitle
       Local oTitle
       Local cTitle := "Modelli e-mail"
       Local cTitle2:= "Crea nuovi modelli o personalizza quelli esistenti"
       Local cImageTitle := "MailModel.bmp"

 RddSetDefault( "DBFCDX" )


  Create_Archive_Modelli_mail()


  USE MAILMOD ALIAS MM


   DEFINE FONT oFontmodelli NAME 'Tahoma' SIZE 0, -12
   DEFINE FONT oFontBoldModelli NAME 'Tahoma' SIZE 0, -12 BOLD



 DEFINE DIALOG oDlgModelli          ;
         SIZE nWidth, nHeight   PIXEL   ;
         TITLE cDlgTitle


    oDlgModelli:lHelpIcon := .F.
    oDlgModelli:nStyle    := nOr( WS_OVERLAPPED,WS_THICKFRAME,WS_SYSMENU,WS_MAXIMIZEBOX,   0  )

        @ 0,0 TITLE  oTitle OF oDlgModelli size 500, 40  SHADOW NOSHADOW GRADIENT { { 1,CLR_WHITE,LIGHTCYAN } }
        @ 10, 12 TITLETEXT OF oTitle TEXT cTitle FONT oFontBoldModelli COLOR CLR_BLACK
        @ 38, 42 TITLETEXT OF oTitle TEXT cTitle2 FONT oFontmodelli COLOR CLR_BLACK
        @ 10, oTitle:nWidth-120 TITLEIMG  oImagetitle  OF oTitle BITMAP cImageTitle TRANSPARENT




  @ 42, 1 XBROWSE  oLbx OF oDlgModelli ;
      SIZE 100 ,oDlgModelli:nBottom-150 PIXEL NOBORDER


           aBrowse   := { { { ||MM->MAILNAME}, i18n("Nome Modello"), 50, }}


 FOR i := 1 TO Len(aBrowse)
      oCol := oLbx:AddCol()
     oCol:bEditValue := aBrowse[ i, 1 ]
   *   oCol:bStrData := aBrowse[ i, 1 ]
      oCol:cHeader  := aBrowse[ i, 2 ]
      oCol:nWidth   := aBrowse[ i, 3 ]
       if !Empty(aBrowse[ i, 4 ])
            oCol:cEditPicture:=aBrowse[ i, 4 ]
         Endif

   NEXT




   oLbx:nStretchCol           := -1
   oLbx:nMarqueeStyle       := MARQSTYLE_HIGHLWIN7 //MARQSTYLE_HIGHLROW
   oLbx:nColDividerStyle    := LINESTYLE_LIGHTGRAY
   oLbx:lColDividerComplete := .t.
   oLbx:lRecordSelector     := .f.
   oLbx:lHScroll            := .f.
   oLbx:CreateFromCode()

    oLbx:bChange  := { || Rinfresca_get(aGet,"MM") }




      @ 45,oLbx:nWidth+10 SAY oSay[1] Prompt  "Nome modello:" of oDlgModelli  size 80,10 PIXEL FONT oFontBoldModelli  COLOR CLR_BLACK
      @ 55,oLbx:nWidth+10 GET aGet[1] VAR MM->MAILNAME  size 115,10 PIXEL of oDlgModelli FONT oFontmodelli  UPDATE
      @ 66,oLbx:nWidth+10 SAY oSay[2] Prompt "Oggetto:" of oDlgModelli  size 80,10 PIXEL FONT oFontBoldModelli  COLOR CLR_BLACK
      @ 76,oLbx:nWidth+10 GET aGet[2] VAR MM->SUBJECT  size 115,10 PIXEL of oDlgModelli FONT oFontmodelli  UPDATE

       hDLL  = LoadLibrary( 'riched20.dll' )
      @ 90,110  RICHEDIT aGet[3] VAR MM->MESSAGE of oDlgModelli PIXEL SIZE 100,100




  oDlgModelli:bResized := {||Rinfresca_oDlgModelli(oTitle,oImagetitle,oDlgModelli,oLbx,oSay,aGet ,oBarMemo) }




 ACTIVATE DIALOG oDlgModelli  centered    ;
    ON INIT  BuildRichEditBar( oDlgModelli, aGet[3],oBarMemo )

    oFontmodelli:Release()
    oFontBoldModelli:Release()

      if hDLL != nil
      FreeLibrary( hDLL )
   endif

   return nil


//-----------------------------------------------------------------------//


 static function BuildRichEditBar( oWnd, oRtf, oBarMemo )

   local oBtn, oBullet, oBold, oItalic, oNumber, oUnderline, oCursor
   local lBold := .F., ;
         lItalic := .F., ;
         lUnderline := .F.,;
         lBullet := .F.,;
         lNumber := .F.



            DEFINE CURSOR oCursor HAND


      @ oRtf:nTop,oRtf:nLeft BUTTONBAR oBarMemo  ;
             SIZE oRtf:nWidth+100,27  3D;
             BUTTONSIZE  26, 27;
             OF oWnd  ;
             CURSOR oCursor

          DEFINE BUTTON oBtn OF oBarMemo ;
          MESSAGE "Create a new file" TOOLTIP "New" NOBORDER ;
          ACTION oRTF:SetText( "" )

   oBtn:hBitmap1 = FWBitmap( "new16" )

   DEFINE BUTTON oBtn OF oBarMemo ;
          MESSAGE "Open a file" TOOLTIP "Open" NOBORDER ;
          ACTION Open()

   oBtn:hBitmap1 = FWBitmap( "open16" )

   DEFINE BUTTON oBtn OF oBarMemo ;
          MESSAGE "Save a file" TOOLTIP "Save" NOBORDER ;
          ACTION Save()

   oBtn:hBitmap1 = FWBitmap( "save16" )

   DEFINE BUTTON oBtn OF oBarMemo ;
          MESSAGE "Close a file" TOOLTIP "Close" NOBORDER ;
          ACTION oWnd:End()

   oBtn:hBitmap1 = FWBitmap( "close16" )

   DEFINE BUTTON oBtn OF oBarMemo GROUP ;
          MESSAGE "Print" TOOLTIP "Print" NOBORDER ;
          ACTION ( oRTF:Print(), oRTF:SetFocus() )

   oBtn:hBitmap1 = FWBitmap( "printer16" )

   DEFINE BUTTON oBtn OF oBarMemo ;
          MESSAGE "Displays full pages" ;
          TOOLTIP "Print Preview" NOBORDER ;
          ACTION oRTF:Preview( "Class TRichEdit")

   oBtn:hBitmap1 = FWBitmap( "preview16" )

   DEFINE BUTTON oBtn OF oBarMemo GROUP ;
          MESSAGE "Search" TOOLTIP "Search" NOBORDER ;
          ACTION ( Find(), oRTF:SetFocus() )

   oBtn:hBitmap1 = FWBitmap( "search16" )

   DEFINE BUTTON oBtn OF oBarMemo GROUP ;
          MESSAGE "Cut" TOOLTIP "Cut" NOBORDER ;
          WHEN ( ! Empty( oRTF:GetSel() ) .and. ! oRTF:lReadOnly ) ;
          ACTION ( oRTF:Cut(), oRTF:SetFocus() )

   oBtn:hBitmap1 = FWBitmap( "cut16" )

   DEFINE BUTTON oBtn OF oBarMemo ;
          MESSAGE "Copy" TOOLTIP "Copy" NOBORDER ;
          WHEN ( ! Empty( oRTF:GetSel() ) ) ;
          ACTION ( oRTF:Copy(), oRTF:SetFocus() )

   oBtn:hBitmap1 = FWBitmap( "copy16" )

   DEFINE BUTTON oBtn OF oBarMemo ;
          MESSAGE "Paste" TOOLTIP "Paste" NOBORDER ;
          WHEN ( /* ! Empty( oClp:GetText() ) .and. */ ! oRTF:lReadOnly ) ;
          ACTION ( oRTF:Paste(), oRTF:SetFocus() )

   oBtn:hBitmap1 = FWBitmap( "paste16" )

   DEFINE BUTTON oBtn OF oBarMemo GROUP ;
          MESSAGE "Undo" TOOLTIP "Undo" NOBORDER ;
          WHEN ( oRTF:SendMsg( EM_CANUNDO ) != 0 ) ;
          ACTION ( oRTF:Undo(), oRTF:SetFocus() )

   oBtn:hBitmap1 = FWBitmap( "undo16" )

   DEFINE BUTTON oBtn OF oBarMemo ;
          MESSAGE "Redo" TOOLTIP "Redo" NOBORDER ;
          WHEN ( oRTF:SendMsg( EM_CANREDO ) != 0 ) ;
          ACTION ( oRTF:Redo(), oRTF:SetFocus() )

   oBtn:hBitmap1 = FWBitmap( "redo16" )

   DEFINE BUTTON oBold OF oBarMemo GROUP ;
          MESSAGE "Bold" TOOLTIP "Bold" NOBORDER ;
          WHEN ! oRTF:lReadOnly ;
          ACTION ( lBold := !lBold, ;
                   oBold:lPressed := lBold, ;
                   oBold:Refresh(), ;
                   oRTF:SetBold( lBold ), oRTF:SetFocus() )

   oBold:hBitmap1 = FWBitmap( "bold16" )
   oBold:Show()

   DEFINE BUTTON oItalic OF oBarMemo ;
          MESSAGE "Italic" TOOLTIP "Italic" NOBORDER ;
          WHEN ! oRTF:lReadOnly ;
          ACTION ( lItalic := !lItalic, ;
                   oItalic:lPressed := lItalic, ;
                   oItalic:Refresh(), ;
                   oRTF:SetItalic( lItalic ), oRTF:SetFocus() )

   oItalic:hBitmap1 = FWBitmap( "italic16" )
   oItalic:Show()

   DEFINE BUTTON oUnderline RESOURCE "Underline" OF oBarMemo ;
          MESSAGE "Underline" TOOLTIP "Underline" NOBORDER ;
          WHEN ! oRTF:lReadOnly ;
          ACTION ( lUnderline := !lUnderline, ;
                   oUnderline:lPressed := lUnderline, ;
                   oUnderline:Refresh(), ;
                   oRTF:SetUnderline( lUnderline ), oRTF:SetFocus() )

   oUnderline:hBitmap1 = FWBitmap( "underline16" )
   oUnderline:Show()

   DEFINE BUTTON RESOURCE "Left" OF oBarMemo GROUP ;
          MESSAGE "Align Left" TOOLTIP "Left" NOBORDER ;
          WHEN ! oRTF:lReadOnly ;
          ACTION ( oRTF:SetAlign( PFA_LEFT ), oRTF:SetFocus() )

   DEFINE BUTTON RESOURCE "Center" OF oBarMemo ;
          MESSAGE "Center" TOOLTIP "Center" NOBORDER ;
          WHEN ! oRTF:lReadOnly ;
          ACTION ( oRTF:SetAlign( PFA_CENTER ), oRTF:SetFocus() )

   DEFINE BUTTON RESOURCE "Right" OF oBarMemo ;
          MESSAGE "Align Right" TOOLTIP "Right" NOBORDER ;
          WHEN ! oRTF:lReadOnly ;
          ACTION ( oRTF:SetAlign( PFA_RIGHT ), oRTF:SetFocus() )

   DEFINE BUTTON RESOURCE "Justify" OF oBarMemo ;
          MESSAGE "Justify" TOOLTIP "Justify" NOBORDER ;
          WHEN ! oRTF:lReadOnly ;
          ACTION ( oRTF:SetAlign( PFA_JUSTIFY ), oRTF:SetFocus() )

   DEFINE BUTTON oNumber RESOURCE "Number" OF oBarMemo GROUP ;
          MESSAGE "Numbering" TOOLTIP "Numbering" NOBORDER ;
          WHEN ! oRTF:lReadOnly .AND. ! oRTF:GetBullet() ;
          ACTION ( lNumber := !lNumber, ;
                   oNumber:lPressed := lNumber, ;
                   oNumber:Refresh(), ;
                   oRTF:SetNumbering( lNumber ), oRTF:SetFocus() )

   DEFINE BUTTON oBullet RESOURCE "Bullet" OF oBarMemo ;
          MESSAGE "Bullets" TOOLTIP "Bullets" NOBORDER ;
          WHEN ! oRTF:lReadOnly .AND. ! oRTF:GetNumbering() ;
          ACTION ( lBullet := !lBullet, ;
                   oBullet:lPressed := lBullet, ;
                   oBullet:Refresh(), ;
                   oRTF:SetBullet( lBullet ), oRTF:SetFocus() )

   DEFINE BUTTON RESOURCE "Exit" OF oBarMemo GROUP ;
          MESSAGE "Exit" ACTION oWnd:End() ;
          TOOLTIP "Salir" NOBORDER

   // AEval( oBar:aControls, { |x| x:nLeft += 272, x:nRight += 272 }, 13 )

   oBarMemo:bLClicked := { || nil }
   oBarMemo:bRClicked := { || nil }

   AEval( oBarMemo:aControls, { |x| x:oCursor := oCursor } )

   return nil



   static function Open()

return nil

static function Save()

return nil

static function Find()

return nil
























//-----------------------------------------------------------------------//


static Function Rinfresca_oDlgModelli(oTitle,oImagetitle,oDlg,oLbx,oSay,aGet,oBarMemo )
   Local aClient := GetClientRect ( oDlg:hWnd )

         //title
          oTitle:nWidth:=oDlg:nWidth
          oTitle:aImgs[1][ 2 ] = oTitle:nWidth-120
          oTitle:refresh()




  //xBrowse
               oLbx:nHeight := oDlg:nHeight-150
               oLbx:nwidth  := oDlg:nwidth/2  -200
               oLbx:refresh()




 //get /say

   oSay[1]:nLeft:= oLbx:nWidth+10
   oSay[2]:nLeft:= oLbx:nWidth+10

   aGet[1]:nLeft:= oLbx:nWidth+10
   aGet[2]:nLeft:= oLbx:nWidth+10

   aGet[3]:nTop:=aGet[2]:nTop+60
   aGet[3]:nLeft:= oLbx:nWidth+10

   aGet[3]:nwidth:= oDlg:nwidth -200
   aGet[3]:nHeight:= oDlg:nHeight-280


   aGet[3]:SetSize( aClient[ 4 ] - aGet[3]:nLeft-10, oDlg:nHeight-280)

   aGet[3]:Refresh()
   aGet[2]:SetSize( aClient[ 4 ] - aGet[2]:nLeft-10, 20)
   aGet[1]:SetSize( aClient[ 4 ] - aGet[1]:nLeft-10, 20)

   IF   oBarMemo != NIL

      oBarMemo:nTop    :=  aGet[3]:nTop-30
      oBarMemo:nRight  :=   aClient[ 4 ] - aGet[3]:nLeft-10
      oBarMemo:nleft   :=  aGet[3]:nLeft

       oBarMemo:setpos(aGet[3]:nTop-30,aGet[3]:nLeft )
       oBarMemo:Refresh()
   endif


    return nil



//------------------------------------------------------------------------------------------//
 static   Function Create_Archive_Modelli_mail()
      Local cDir :=""

    DbCreate(cDir+'mm', {  {'MAILNAME' , 'C',  30,   0} ,;
                      {'SUBJECT'  , 'C',  30,   0} ,;
                      {'MESSAGE'  , 'M',  10,  0}}, 'DBFCDX')

     close all
      use &(cDir+'mm') new
      select mm
      if FILE(cDir+'MailMod.DBF')
         delete file &(cdir+'MailMod.cdx')
         append from &(cdir+'MailMod')
         dbcommitall()
         close all
         delete file &(cdir+'MailMod.dbf')
         delete file &(cdir+'MailMod.fpt')
      endif
      close all
      rename &(cdir+'mm.dbf') to &(cdir+'MailMod.dbf')
      rename &(cDir+'mm.fpt') to &(cDir+'MailMod.fpt')
      close all
    return nil



 //------------------------------------------------------------------------------------------//

Function Rinfresca_get(aGet,cDbf)

   nRecAdd := (cDbf)->(RecNo())

   aGet[1]:ctext:=   MM->MAILNAME
   aGet[2]:ctext:=   MM->SUBJECT
   aGet[3]:ctext:=   MM->MESSAGE

   return nil





 
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: 7068
Joined: Thu Oct 18, 2012 7:17 pm

Re: Richedit on a dialog

Postby Antonio Linares » Wed Apr 20, 2016 9:23 am

Silvio,

Please test your example before posting it:

Application
===========
Path and name: c:\fwteam\samples\silvio.exe (32 bits)
Size: 3,552,256 bytes
Compiler version: Harbour 3.2.0dev (r1603082110)
FiveWin Version: FWH 16.03
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 0 secs
Error occurred at: 04/20/16, 11:22:21
Error description: Error BASE/1132 Bound error: array access
Args:
[ 1] = A { ... } length: 0
[ 2] = N 1

Stack Calls
===========
Called from: silvio.prg => RINFRESCA_ODLGMODELLI( 363 )
Called from: silvio.prg => (b)TEST( 117 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:RESIZE( 2193 )
Called from: .\source\classes\DIALOG.PRG => (b)TDIALOG( 96 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:RESIZE( 0 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 905 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 293 )
Called from: silvio.prg => TEST( 123 )
regards, saludos

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

Re: Richedit on a dialog

Postby Silvio.Falconi » Wed Apr 20, 2016 9:28 am

sorry here run the exe
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: 7068
Joined: Thu Oct 18, 2012 7:17 pm

Re: Richedit on a dialog

Postby Silvio.Falconi » Wed Apr 20, 2016 9:47 am

Antonio,
it need a bitmap file I cannot publish

Local cImageTitle := "MailModel.bmp"

you can modify it with

Local cImageTitle := "c:\fwh\bitmap\Mail.bmp"

sorry
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: 7068
Joined: Thu Oct 18, 2012 7:17 pm

Re: Richedit on a dialog

Postby Antonio Linares » Wed Apr 20, 2016 11:00 am

Silvio,

The error comes from here:

oTitle:aImgs[1][ 2 ] = oTitle:nWidth-120
regards, saludos

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Marc Venken and 79 guests