New FWH 19.09

User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: New FWH 19.09

Post by nageswaragunupudi »

We recommend not to use bOnPostEdit. That was necessary in the very early years when xbrowse was new.
Let the xbrowse automatically create this codeblock.

Code: Select all

#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   local oDlg, oBrw, oFont

   USE STATES NEW SHARED VIA "DBFCDX"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 500,500 PIXEL TRUEPIXEL FONT oFont

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "STATES" ;
      COLUMNS "CODE", "NAME" ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :nEditTypes    := EDIT_GET
      :nStretchCol   := 2
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
 
Please test this program.
When you edit and press enter key, the changes are saved.
Same way in the older version as well as in FWH1909
Regards

G. N. Rao.
Hyderabad, India
AntoninoP
Posts: 347
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy
Contact:

Re: New FWH 19.09

Post by AntoninoP »

there is a way to set the change saved on exit edit? without press return?
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: New FWH 19.09

Post by ukoenig »

I tested again without any success

with FWH 19.06 no problem :!:
with FWH 19.09 I have to save the value to the DBF after celledit -> return
otherwise the cell stays empty :roll:
I couldn't detect anything strange inside the xbrowse-section

there are 2 exe-files included in the download
one compiled with FWH 19.06 without using :bOnPostEdit with NO problem
the other exe is compiled with FWH 19.09 and a included :bOnPostEdit

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

Re: New FWH 19.09

Post by nageswaragunupudi »

Mr Uwe

Did you try the sample I posted or not?
Do you have the problem in the sample I posted?
Regards

G. N. Rao.
Hyderabad, India
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: New FWH 19.09

Post by ukoenig »

Yes a normal structured Xbrowse is working fine.
I'm looking for something that is maybe added inside the xBrowse-section
and derange the logic.
I'm wondering that it works without any problem using FWH 19.06 :roll:

Code: Select all

@ 40, 20 XBROWSE oBrw SIZE 820, 176 PIXEL OF oDlg ;
DATASOURCE oProject ;
AUTOSORT FOOTERS FASTEDIT ;
COLUMNS "Group", "Section", "Position", "Exe", "Grouptext", "Btntext", "Link", ;
                    "Message1", "Message2", "Tooltip1", "Tooltip2", "Tooltip3" ;
HEADERS "Grp.","Sect.", "Pos.", "Exe", "Grouptext", "Buttontext", "Link", ;
                   "Message-line 1", "Message-line 2", "Tooltip-head", "Tooltip-text1", "Tooltip-text2" ;
COLSIZES 30, 30, 30, 30, 130, 220, 600, 205, 207, 80, 80, 80 

oBrw:nMarqueeStyle  := MARQSTYLE_HIGHLCELL
oBrw:nColDividerStyle   := LINESTYLE_BLACK
oBrw:nRowDividerStyle   := LINESTYLE_BLACK
oBrw:Exe:SetCheck( , .t. )

WITH OBJECT oBrw
    :lHeader                := .T.
    :nHeaderHeight      := 25
    :lFooter                := .F.
    :lHScroll               := .F.
    :lVScroll               := .F.
    :nFreeze                := 4
    :lAllowRowSizing        := .F. 
    :lAllowColHiding        := .F. 
    :lAllowColSwapping      := .F.
    :lColChangeNotify       := .t.
    
    I := 4 // editget from column 4 - 12
    FOR I := 4 to len( oBrw:aCols )
          :aCols[ I ]:nEditType := EDIT_GET

          // ------- only FWh 19.09 ----------

         //        :aCols[ I ]:bOnPostEdit := {|oCol, xVal, nKey| IF( nKey == VK_RETURN, ; 
         //                        oProject:FieldPut( oCol:nCreationOrder, xVal ), ), ; 
         //                        oProject:Save(), oBrw:RefreshCurrent() }

          // ------- only FWh 19.09 ----------

    NEXT

    :bClrStd        := { || If( oBrw:KeyNo() % 2 == 0, ;
                       { If( oProject:Deleted(), 255, 0 ), 11392685 }, ;
                       { If( oProject:Deleted(), 255, 0 ), 14741472 } ) }
    
    :bClrEdits  := { || { CLR_HRED, CLR_YELLOW } }
    
    :bChange    := { || oCol := oBrw:SelectedCol(), ;
                                nColNo := oBrw:SelectedCol():nCreationOrder, ; 
                                cFieldget := PADR( oCol:Value, 200, " " ), oFieldget:Refresh() }

    :bLClicked  := { || oCol := oBrw:SelectedCol(), ; 
                                nColNo := oBrw:SelectedCol():nCreationOrder, ; 
                                cFieldget := PADR( oCol:Value, 200, " " ), oFieldget:Refresh() }

       :CreateFromCode()
END
AEval( oBrw:aCols, { |oCol, n| oCol:lAllowSizing := .F. } ) 
 
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.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: New FWH 19.09

Post by nageswaragunupudi »

What is oProject? TDatabase object?

Can you give a similar small sample using any DBF in the fwh samples folder? So that we can build at our end and test it
Regards

G. N. Rao.
Hyderabad, India
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: New FWH 19.09

Post by ukoenig »

Yes,
I will create a sample that will work inside the sample-folder without all the defined extras.

The defined TDatabase

// CreateIndex( cFile, cTag, cKey, lUnique, lDescend, lMemory )
oProject := TDatabase():Open( , "PROJECT", "DBFCDX", .T. )
oProject:CreateIndex( "PROJECT", "PROJ1", "Group + Section + Position", .F. )

regards
Uwe :D
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
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: New FWH 19.09

Post by nageswaragunupudi »

AntoninoP wrote:there is a way to set the change saved on exit edit? without press return?
oCol:lAutoSave := .t.

To set for all columns,

oBrw:lAutoSaves := .t.
Regards

G. N. Rao.
Hyderabad, India
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: New FWH 19.09

Post by ukoenig »

A full working PRG that runs from inside the FWH-sample-folder without any changes and uses < customer.dbf >
< state > is used as a group-selector / filter from the radio
I added scrollbars
Tested with the same effect :(

Image

Code: Select all

#include "FiveWin.ch"

STATIC oDlg

FUNCTION MAIN()
LOCAL oFontSys, oBrw, oProject, cLink := ""
LOCAL oGet, oBtnSys[9], nCol, oRadio, c_Path, c_Path1
LOCAL nGrpPos := 1, I, oSay
LOCAL oFieldget, cFieldget := SPACE(200), nColNo := 2

DEFINE FONT oFontSys NAME "Arial" SIZE 0, -14
DEFINE FONT oFontLarge NAME "Arial" SIZE 0, -24 BOLD
c_Path := cFilePath(GetModuleFileName( GetInstance() ) ) 
c_Path1 :=  c_Path + "..\BITMAPS\32x32\"

aGrad := { { 0.5, 14927760,16579318 }, { 0.5, 16579318, 14927760 } }
DEFINE BRUSH oBrush GRADIENT aGrad STRETCH

REQUEST DBFCDX
RDDSETDEFAULT ( "DBFCDX" )
 
// CreateIndex(  cFile,  cTag,   cKey,   lUnique, lDescend, lMemory )
oProject := TDatabase():Open( , "CUSTOMER", "DBFCDX", .T. )
oProject:CreateIndex( "CUSTOMER", "PROJ1", "State", .F. )

oProject:ORDSCOPE(0, "A" ) 
oProject:ORDSCOPE(1, "A" ) 

DEFINE DIALOG oDlg SIZE 850, 300 PIXEL TRUEPIXEL TITLE "xBrowse-test  "  + FWVERSION   

@  5, 50  SAY oSay PROMPT "xBrowse-celledit -> " + FWVERSION  SIZE 450, 35 OF oDlg FONT oFontLarge PIXEL
oSay:SetColor( 255, ) 
oSay:lTransparent := .T.

// ---------- Close

@ 6, oDlg:nWidth - 40 BTNBMP oBtnSys[1] OF oDlg ;
FILE  c_path1 + "Exit.bmp", "", "", ;
          c_path1 + "Quit.bmp" ;
FLAT NOBORDER NOROUND ACTION oDlg:End() SIZE 30, 30 
oBtnSys[1]:lTransparent := .T.
oBtnSys[1]:cToolTip := { "Exit xBrowse-edit", "EXIT", 1, CLR_BLACK, 14089979 } 

// ---- 1. section -----

oProject:ORDSCOPE(0, "A" ) // set top scope
oProject:ORDSCOPE(1, "A" ) // set bottom scope
oProject:GoTop()
 
@ 40, 20 XBROWSE oBrw SIZE 750, 195 PIXEL OF oDlg ;
DATASOURCE oProject ;
AUTOSORT FOOTERS FASTEDIT ;
COLUMNS "State", "First", "Last", "Street", "City", "Age", "Salary" ;
HEADERS  "State", "First", "Last", "Street", "City", "Age", "Salary" ;
COLSIZES 50, 150, 150, 220, 150, 100, 100 FONT oFontsys

oBrw:nMarqueeStyle  := MARQSTYLE_HIGHLCELL
oBrw:nColDividerStyle   := LINESTYLE_BLACK
oBrw:nRowDividerStyle   := LINESTYLE_BLACK

WITH OBJECT oBrw
    :lHeader                := .T.
    :nHeaderHeight      := 28
    :lFooter                := .F.
    :lHScroll               := .T.
    :lVScroll               := .T.
    :nFreeze                := 1
    :lAllowRowSizing        := .F. 
    :lAllowColHiding        := .F. 
    :lAllowColSwapping      := .F.
    :lColChangeNotify       := .t.
 
    I := 2 // editget from column 2 - 3
    FOR I := 2 to len( oBrw:aCols )
          :aCols[ I ]:nEditType := EDIT_GET
 
// ------- only FWh 19.09 ----------

//        :aCols[ I ]:bOnPostEdit := {|oCol, xVal, nKey| IF( nKey == VK_RETURN, ; 
//                         oProject:FieldPut( oCol:nCreationOrder, xVal ), ), ; 
//                         oProject:Save(), oBrw:RefreshCurrent() }

// ------- only FWh 19.09 ----------

    NEXT

    :bClrStd        := { || If( oBrw:KeyNo() % 2 == 0, ;
                       { If( oProject:Deleted(), 255, 0 ), 11392685 }, ;
                       { If( oProject:Deleted(), 255, 0 ), 14741472 } ) }
    
    :bClrEdits  := { || { CLR_HRED, CLR_YELLOW } }
    
    :bChange    := { || oCol := oBrw:SelectedCol(), ;
                                nColNo := oBrw:SelectedCol():nCreationOrder, ; 
                                cFieldget := PADR( oCol:Value, 200, " " ), oFieldget:Refresh() }

    :bLClicked  := { || oCol := oBrw:SelectedCol(), ; 
                                nColNo := oBrw:SelectedCol():nCreationOrder, ; 
                                cFieldget := PADR( oCol:Value, 200, " " ), oFieldget:Refresh() }

       :CreateFromCode()
END
AEval( oBrw:aCols, { |oCol, n| oCol:lAllowSizing := .F. } ) 

@ 40, 800 RADIO oRadio VAR nGrpPos OF oDlg  PIXEL UPDATE  ;
ITEMS "&A", "&C", "&D", "&F", "&G"_3D SIZE 30, 35 ;
HELPID 200, 201, 202, 204, 205  ;
ON CHANGE ( SET_GROUP( oProject, nGrpPos), ;
                           oProject:GoTop(), oBrw:Refresh() )
AEval( oRadio:aItems, { | oRad | oRad:lTransparent := .T., ;
                               oRad:SetFont ( oFontSys ), ;
                               oRad:nClrText := 0 } )

@ 258, 45 GET oFieldget VAR  cFieldget SIZE 720, 22  OF oDlg  PIXEL UPDATE FONT oFontSys

@ 257, 770 BTNBMP oBtnSys[8] OF oDlg ;
SIZE 30, 30 PIXEL 2007 ; // B / H
FILE  c_path1 + "Save.bmp", "", "", ;
          c_path1 + "Setup.bmp" ;
ACTION ( oFieldget:Refresh(), ;
          cField := oProject:FieldName(nColNo), ; 
          oProject:FieldPut( cField, cFieldget ), ; 
          oProject:Save(), oBrw:RefreshCurrent() ) ;
NOBORDER LEFT
oBtnSys[8]:lTransparent := .T.
oBtnSys[8]:cToolTip := { "Save new value", "SAVE", 1, CLR_BLACK, 14089979 } 

@ 257, 805 BTNBMP oBtnSys[9] OF oDlg ;
SIZE 30, 30 PIXEL 2007 ; // B / H
FILE  c_path1 + "Delete.bmp", "", "", ;
          c_path1 + "Cut.bmp" ;
ACTION ( cFieldget := SPACE( 200 ), oFieldget:Refresh(), ;
          cField := oProject:FieldName(nColNo), ; 
          oProject:FieldPut( cField, cFieldget ), ; 
          oProject:Save(), oBrw:RefreshCurrent() ) ;
NOBORDER LEFT
oBtnSys[9]:lTransparent := .T.
oBtnSys[9]:cToolTip := { "Delete value", "DELETE", 1, CLR_BLACK, 14089979 } 

ACTIVATE DIALOG oDlg CENTERED ;
ON iNIT oDlg:SetBrush( oBrush )

RELEASE BRUSH oBrush 
RELEASE FONT oFontSys, oFontLarge
CLOSE DATABASE

RETURN NIL

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

STATIC FUNCTION SET_GROUP( oProject, nGrpPos)

oProject:ORDSCOPE(0, NIL ) 
oProject:ORDSCOPE(1, NIL ) 

IF nGrpPos = 1
    oProject:ORDSCOPE(0, "A" ) 
    oProject:ORDSCOPE(1, "A" ) 
ELSEIF nGrpPos = 2
    oProject:ORDSCOPE(0, "C" ) 
    oProject:ORDSCOPE(1, "C" ) 
ELSEIF nGrpPos = 3
    oProject:ORDSCOPE(0, "D" ) 
    oProject:ORDSCOPE(1, "D" ) 
ELSEIF nGrpPos = 4
    oProject:ORDSCOPE(0, "F" ) 
    oProject:ORDSCOPE(1, "F" ) 
ELSEIF nGrpPos = 5
    oProject:ORDSCOPE(0, "G" ) 
    oProject:ORDSCOPE(1, "G" ) 
ENDIF

RETURN NIL
regards
Uwe :D
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
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: New FWH 19.09

Post by nageswaragunupudi »

I built your sample code, without any changes, and tested it.
Your point is that cell edits are not being saved in 1909 unless we add extra code to save.
I did not notice any such problem.
Here I found that cell edits are all being saved correctly.

Image

Am I missing something?
If you help us to reproduce your problem, we can provide a solution.
Regards

G. N. Rao.
Hyderabad, India
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: New FWH 19.09

Post by ukoenig »

I found the problem with xbrouse EDIT_GET

all tests using TDatabase and new compiled with FWH 19.09
don*t save the data anymore on celledit
Reverse compiled with FWH 19.06 it works again.

as well I tested using DATASOURCE oCustomer and OBJECT oCustomer
with no difference

-----------------

oCustomer := TDatabase():Open( , "CUSTOMER", "DBFCDX", .T. )
//USE CUSTOMER NEW SHARED VIA "DBFCDX"

@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE oCustomer ;
COLUMNS "STATE", "First", "Last" ;
HEADERS "STATE", "First", "Last" ;
CELL LINES NOBORDER
// no difference adding FASTEDIT

WITH OBJECT oBrw
:nEditTypes := EDIT_GET
:CreateFromCode()
END

-------------

trgards
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.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: New FWH 19.09

Post by nageswaragunupudi »

I tested your second program exactly as you gave. I do not see any problem. Celledit saves data correcly.

Image

Both your programs work with TDatabase() objects only. In both cases, the cell-edits are saved correctly.
Regards

G. N. Rao.
Hyderabad, India
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: New FWH 19.09

Post by ukoenig »

I'm helpless :roll:

I did a complete new install of FWH 19.09 and getting different results
for the moment I will keep the extra lines < :bOnPostEdit >

Image

thank You very much

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

Re: New FWH 19.09

Post by nageswaragunupudi »

May be your problem is with the bOnPostEdit.

If you keep your code very simple, xbrowse does its job faithfully and correctly.

If you test the above two programs exactly, you will not get any problems and you should also get the same results as I am getting here.
Regards

G. N. Rao.
Hyderabad, India
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: New FWH 19.09

Post by byte-one »

Mr. Rao, any solution on this points?
http://forums.fivetechsupport.com/viewt ... 83#p226473
Regards,
Günther
---------------------------------
office@byte-one.com
Post Reply