Detect Memo Field

Detect Memo Field

Postby Silvio.Falconi » Wed May 01, 2013 4: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 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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Detect Memo Field

Postby ADutheil » Wed May 01, 2013 8:16 pm

Code: Select all  Expand view
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
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Detect Memo Field

Postby ukoenig » Wed May 01, 2013 10:00 pm

Silvio,

there is a sample : xBrMemo.prg

Best Regards
Uwe :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Detect Memo Field

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Detect Memo Field

Postby Silvio.Falconi » 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 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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Detect Memo Field

Postby ADutheil » Thu May 02, 2013 11:22 am

You can modify the function ChkForMemo to return an array to populate your combobox

Code: Select all  Expand view
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
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Detect Memo Field

Postby Silvio.Falconi » 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)>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:=(cDbf)->&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 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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Detect Memo Field

Postby ADutheil » Thu May 02, 2013 1:34 pm

Code: Select all  Expand view
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
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Detect Memo Field

Postby Antonio Linares » Thu May 02, 2013 1:57 pm

Silvio,

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

Image
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests