Edit Extended / Edit WorkArea - ABM / ABM2

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

User avatar
tonton2
Posts: 245
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Has thanked: 3 times
Been thanked: 6 times
Contact:

Re: edit extended

Post by tonton2 » Tue Jul 09, 2013 6:54 pm

Merci beaucoup,
L'Algerie vous salut
Y.TABET

radohabjan
Posts: 92
Joined: Mon Nov 30, 2009 7:17 am
Location: Slovenia
Contact:

Post by radohabjan » Wed Jul 31, 2013 8:30 pm

Hello HMG friends,

thanks for new release,

I tested Edit Extend and I got an error
Please see attached files.

br Rado
Capture.JPG
Capture.JPG (79.79 KiB) Viewed 967 times
EEDEMO.ZIP
(1.14 MiB) Downloaded 78 times
[u]Moderator Notes[/u] (Pablo César) wrote:Your Topic was moved from HMG Unicode version because your message is not regarding HMG version.

User avatar
Pablo César
Posts: 4058
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 177 times

Post by Pablo César » Wed Jul 31, 2013 10:12 pm

Hi Rado,

I have checked your source code and noted this line:

CLOSE SIF_DAVK

At procedure sifdavk() which need to let it as comment (disable this line):

// CLOSE SIF_DAVK

Otherwise you are closing database. But will need to close when exit application, so you will need to add this SIF_DAVK->( dbCloseArea() ) at Win_1 declaration in ON INTERACTIVECLOSE.

Also will be necessary to move USE SIF_DAVK at begining of Main and NET treatment (OPEN in SHARED mode).

Code: Select all

#include "hmg.ch"
// #include "fileio.ch"

PROCEDURE Main
SET LANGUAGE TO SLOVENIAN
REQUEST HB_CODEPAGE_SLWIN
HB_CDPSELECT("SLWIN")
HMG_MESSAGES_UTF8_TO_ANSI("SLWIN")

USE SIF_DAVK SHARED

// msginfo(HMG_CharSetName()+" "+HMG_GetLanguage())
DEFINE WINDOW Win_1  AT 0,0 WIDTH 540 HEIGHT 460 MAIN ON INTERACTIVECLOSE SIF_DAVK->( dbCloseArea() )

ON KEY ESCAPE ACTION Win_1.Release

 Define Button Button_4
 Row	300
 Col	80
 Caption 'Test EDIT'
 Action sifdavk()
 End Button

END WINDOW
Win_1.Center
Win_1.Activate
RETURN

procedure sifdavk()
 // Local variable declarations.----------------------------------------
LOCAL aFieldName   := { "Šifra", "Naziv davka", "Tarifa", "Davek v %", "Mejni datum", ;
                      "Davek % pred sprem.", "Skupaj"  }
LOCAL aVisTable    := { .t., .t., .t., .t., .t., .t., .f. }
LOCAL aFieldEdit   := { .t., .t., .t., .t., .t., .t., .f. }
LOCAL aOptions     := Array( 3, 2 )
LOCAL bSave        := {|aValues, lNew| sifdavksave( aValues, lNew, cArea ) }
LOCAL bSearch      := {|| MsgInfo( "Your own search function" ) }
LOCAL bPrint       := {|| MsgInfo( "Your own print function" ) }
aOptions[1,1] := "Možnost 1"
aOptions[1,2] := { || MsgInfo( "" ) }
aOptions[2,1] := "Možnost 1"
aOptions[2,2] := { || MsgInfo( "" ) }
aOptions[3,1] := "Opis programa"
aOptions[3,2] := { || MsgInfo( "" ) }
// USE SIF_DAVK
cArea="SIF_DAVK"
SIF_DAVK->( ordListAdd( "DAVK1.NTX", "Šifra davka" ) )
SIF_DAVK->( ordSetFocus( 1 ) ) 
EDIT EXTENDED                           ;
        WORKAREA SIF_DAVK               ;
        TITLE "Davène skupine"   	;
        FIELDNAMES aFieldName           ;
        FIELDENABLED aFieldEdit         ;
        TABLEVIEW aVisTable             ;
        OPTIONS aOptions                ;
        ON SAVE bSave                  
// CLOSE SIF_DAVK
return

function sifdavksave( aValues, lNew, cArea )
LOCAL i := 1
IF Empty( aValues[1] )   // First name.
   msgInfo( "Šifra davka mora biti vnešena !" )
   return ( .f. )
ENDIF
IF lNew
   sif_davk->( dbAppend() )
ENDIF
FOR i := 1 TO Len( aValues )
    rlock()
    sif_davk->( FieldPut( i, aValues[i] ) )
    unlock
NEXT  
return ( .t. )


FUNCTION HMG_MESSAGES_UTF8_TO_ANSI (cCPID)
LOCAL k, i, nIndex, cUTF8Str, cANSIStr
LOCAL aPos := {128, 129, 130, 131, 132, 133, 134, 136, 137, 331, 371}
   FOR k = 1 TO HMG_LEN (aPos)
      nIndex := aPos [k]
      IF ValType (_HMG_SYSDATA [nIndex]) == "A"
         FOR i = 1 TO HMG_LEN (_HMG_SYSDATA [nIndex])
            cUTF8Str := _HMG_SYSDATA [nIndex] [i]
            cANSIStr := HB_UTF8TOSTR (cUTF8Str, cCPID)
            _HMG_SYSDATA [nIndex] [i] := cANSIStr 
         NEXT
      ELSE
         cUTF8Str := _HMG_SYSDATA [nIndex]
         cANSIStr := HB_UTF8TOSTR (cUTF8Str, cCPID)
         _HMG_SYSDATA [nIndex] := cANSIStr 
      ENDIF
   NEXT
RETURN NIL
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

radohabjan
Posts: 92
Joined: Mon Nov 30, 2009 7:17 am
Location: Slovenia
Contact:

Post by radohabjan » Thu Aug 01, 2013 10:17 am

Hello HMG friends,

thanks for new release. I already tested all functionalities.
I found an error in EDIT EXTEND function.
See in attached file.

br Rado
Attachments
Capture.JPG
Capture.JPG (79.79 KiB) Viewed 940 times
EEDEMO.ZIP
(1.14 MiB) Downloaded 49 times

radohabjan
Posts: 92
Joined: Mon Nov 30, 2009 7:17 am
Location: Slovenia
Contact:

Post by radohabjan » Thu Aug 01, 2013 11:29 am

Hello Pablo,

thanks for quick solution.
Is there possible to have another two parameters in function EDIT EXTEND :
HEIGHT and WIDTH

EDIT EXTENDED ;
HEIGHT 300;
WIDTH 400 ;
WORKAREA SIF_DAVK ;
TITLE "Davčne skupine" ;
FIELDNAMES aFieldName ;
FIELDENABLED aFieldEdit ;
TABLEVIEW aVisTable ;
OPTIONS aOptions ;
ON SAVE bSave

br Rado

radohabjan
Posts: 92
Joined: Mon Nov 30, 2009 7:17 am
Location: Slovenia
Contact:

Post by radohabjan » Thu Aug 01, 2013 12:44 pm

Hello Pablo,

now I have problem by save function in EDIT EXTENDED:
Attachments
Capture.JPG
Capture.JPG (68.89 KiB) Viewed 916 times

User avatar
Pablo César
Posts: 4058
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 177 times

Post by Pablo César » Thu Aug 01, 2013 4:35 pm

radohabjan wrote:Is there possible to have another two parameters in function EDIT EXTEND :
HEIGHT and WIDTH

EDIT EXTENDED ;
HEIGHT 300;
WIDTH 400 ;
WORKAREA SIF_DAVK ;
TITLE "Davčne skupine" ;
FIELDNAMES aFieldName ;
FIELDENABLED aFieldEdit ;
TABLEVIEW aVisTable ;
OPTIONS aOptions ;
ON SAVE bSave
I understand your question. It is due missing part of scrolling window, as showing in this image:
Screen.PNG
Screen.PNG (27.67 KiB) Viewed 897 times
-------------
radohabjan wrote:now I have problem by save function in EDIT EXTENDED: "Variable does not exist: cArea"
This as the error message shows it is not finding the cArea variable. So at begining of your prg add red lines as shows below:

Function Main
Private cArea

SET LANGUAGE TO SLOVENIAN
REQUEST HB_CODEPAGE_SLWIN
HB_CDPSELECT("SLWIN")
HMG_MESSAGES_UTF8_TO_ANSI("SLWIN")

USE SIF_DAVK SHARED
cArea="SIF_DAVK"

// msginfo(HMG_CharSetName()+" "+HMG_GetLanguage())
DEFINE WINDOW Win_1...//...


I will try to promote a change in windows EDIT EXTENDED to be displayed in full.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Pablo César
Posts: 4058
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 177 times

Post by Pablo César » Thu Aug 01, 2013 5:39 pm

For now to solve this problem:
Image
You will need to correct in C:\hmg.3.1.5\SOURCE\EDITEX\h_edit_ex.prg file, lines:

Line 642, this: height _nAltoPantalla - 140 ;

replace for this: height _nAltoPantalla - 120 ;

AND

Line 951, this: nAlto := 15 + 65 + nAltoSplit + 15

replace for this: nAlto := 15 + 75 + nAltoSplit + 15

Save C:\hmg.3.1.5\SOURCE\EDITEX\h_edit_ex.prg file and click in C:\hmg.3.1.5\SOURCE\EDITEX\buildlib.bat (to rebuild the LIB). After this you can recompile your app.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

radohabjan
Posts: 92
Joined: Mon Nov 30, 2009 7:17 am
Location: Slovenia
Contact:

Post by radohabjan » Thu Aug 01, 2013 8:34 pm

I mean more, that :

_nAltoPantalla := getDesktopHeight()
_nAnchoPantalla := getDesktopWidth()

would be parameters and not fixed value in h_edit_ex.prg

User avatar
tonton2
Posts: 245
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Has thanked: 3 times
Been thanked: 6 times
Contact:

Post by tonton2 » Fri Aug 09, 2013 10:22 pm

Hello,
Please how to add a "InputMask" to "EDIT.EXTENDED" for a character field.
Ex: Field => "CHARACTER" InputMask "9999999"
or aColx: = {"TEXTBOX", "CHARACTER", "9999999"}
Thank you in advance
L'Algerie vous salut
Y.TABET

Post Reply