FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Detect Memo Field
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Detect Memo Field
Posted: Wed May 01, 2013 04:04 PM

If I have a xbrowse and wish see (or edit) a Memo Field How I can Make ?
First I must see if there is a Memo Field and then iI can open a Dialog with a get ..Memo
How I can detect if on fields of xbrowse column there is or there memo fields ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Detect Memo Field
Posted: Wed May 01, 2013 08:16 PM
Code (fw): Select all Collapse
FUNCTION ChkForMemo( cAlias )
LOCAL aStru := ( cAlias )->( dbStruct() )
LOCAL lRetu := .F.

aEval( aStru, { | x | if( x[ 2 ] == "M", lRetu := .T., ) } )
RETURN ( lRetu )
Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Detect Memo Field
Posted: Wed May 01, 2013 10:00 PM
Silvio,

there is a sample : xBrMemo.prg

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Detect Memo Field
Posted: Wed May 01, 2013 11:20 PM
How I can detect if on fields of xbrowse column there is or there memo fields ?

oCol:cDataType

Note: If you create xbrowse with full command syntax.
Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Detect Memo Field
Posted: Thu May 02, 2013 10:44 AM

Sorry ,
Thank ADutheil
Now I Know the dbf have the memo field but I canno Know the name of this or these fileds to edit

but I not Know wich i s the name of the field(s) Memo

Ihave a xbrowse with

....
@ 0, 0 XBROWSE oBrwLook OF oDlgLook SIZE -1,-20 PIXEL ;
DATASOURCE cdbf ;
COLUMNS aFields HEADERS aNames COLSIZES aSizes

for n := 1 to Len( oBrwLook:aCols )
if oBrwLook:aCols[ n ]:cDataType == 'M'
oBrwLook:aCols[ n ]:bStrData = GenLocalBlock( oBrwLook:aCols, n )
endif
next
....

function GenLocalBlock( aCols, n )
return { || If( Empty( Eval( aCols[ n ]:bEditValue ) ), "<memo>", "<Memo>" ) }

I see the column with the text " Memo"

then from a toolbar I wish edit all memo field on this table
I made :
static function VistaMemo(oBrwLook,cDbf)
IF ChkForMemo( cDbf ) // function of ADutheil

                //edit Memo
                // If I have two fields type memo I must use a combobox to select the field or I can edit the fied Memo with  as  xBrMemo.prg

        Endif

Return nil

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Detect Memo Field
Posted: Thu May 02, 2013 11:22 AM
You can modify the function ChkForMemo to return an array to populate your combobox

Code (fw): Select all Collapse
FUNCTION ChkForMemo( cAlias )
LOCAL aStru := ( cAlias )->( dbStruct() )
LOCAL aMemo := {}

aEval( aStru, { | x | if( x[ 2 ] == "M", aAdd( aMemo, x[ 1 ] ) , ) } )
RETURN ( aMemo )
Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Detect Memo Field
Posted: Thu May 02, 2013 11:38 AM

ok but how I can set the field from combobox to edit that field
I explain I must set cNotes:=cdbf->namefieldMemo

@ 10,25 COMBOBOX oCbx VAR cCbx ITEMS aCampiMemo;
SIZE 80,50 PIXEL OF oDlg STYLE CBS_DROPDOWN ;
ON CHANGE cNotes:=(cDbf)-> ?

see the test
static function VistaMemo(oBrwLook,cDbf)
Local aCampiMemoTitle:= {}
Local aCampiMemo:= ChkForMemo( cDbf )
Local oCbx,cCbx
local oGet,cnotes

IF  len(aCampiMemo)&gt;0
      DEFINE DIALOG oDlg SIZE 400,200  PIXEL TITLe &quot;Vista Memo&quot;
      @ 10,5 SAY &quot;Tipo:&quot;  SIZE 40,10  PIXEL OF oDlg
      @ 10,25 COMBOBOX oCbx VAR cCbx  ITEMS aCampiMemo;
      SIZE 80,50 PIXEL OF oDlg  STYLE CBS_DROPDOWN ;
      ON CHANGE cNotes:=(cDbf)-&gt;&amp;nAt

      @ 24,25 GET oGet VAR cNotes TEXT SIZE 80,40 PIXEL OF oDlg
      ACTIVATE DIALOG oDlg center
   ENDIF

RETURN NIL

FUNCTION ChkForMemo( cAlias )
LOCAL aStru := ( cAlias )->( dbStruct() )
LOCAL aMemo := {}

aEval( aStru, { | x | if( x[ 2 ] == "M", aAdd( aMemo, x[ 1 ] ) , ) } )
RETURN ( aMemo )

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Detect Memo Field
Posted: Thu May 02, 2013 01:34 PM
Code (fw): Select all Collapse
STATIC FUNCTION VistaMemo(oBrwLook,cDbf)
Local aCampiMemoTitle:= {}
Local aCampiMemo:= ChkForMemo( cDbf )
Local oCbx,cCbx
local oGet,cnotes


IF len(aCampiMemo)>0
    DEFINE DIALOG oDlg SIZE 400,200 PIXEL TITLe "Vista Memo"
    @ 10,5 SAY "Tipo:" SIZE 40,10 PIXEL OF oDlg
    @ 10,25 COMBOBOX oCbx VAR cCbx ITEMS aCampiMemo SIZE 80,50 PIXEL OF oDlg STYLE CBS_DROPDOWN ON CHANGE (cNotes:= GetMemo( cDbf, cCbx ), oGet:Refresh() )

    @ 24,25 GET oGet VAR cNotes TEXT SIZE 80,40 PIXEL OF oDlg
    ACTIVATE DIALOG oDlg center
ENDIF

RETURN NIL

STATIC FUNCTION ChkForMemo( cAlias )
LOCAL aStru := ( cAlias )->( dbStruct() )
LOCAL aMemo := {}

aEval( aStru, { | x | if( x[ 2 ] == "M", aAdd( aMemo, x[ 1 ] ) , ) } )
RETURN ( aMemo )

STATIC FUNCTION GetMemo( cDbf, cCbx )
RETURN (cDbf)->(&cCbx)
Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Detect Memo Field
Posted: Thu May 02, 2013 01:57 PM
Silvio,

FWH samples/fivedbu.prg automatically detects a memo field and offers its edition :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion