In the dialog There are also some buttons: Insert button and Delete button that are working The question is In the action of edit button which instruction I have to write in if I want the same behaviour of VK_RETURN pressed? Best regards Marco
WITH OBJECT oBrw :aCols[1]:nEditType := EDIT_GET END ACTIVATEDIALOG oDlg
I recommend using COLUMNS clause to create columns than using oBrw:AddCol() and assigning various datas to each column object.
COLUMNS clause for creating of columns is extremely powerful. XBrowse checks the column name with the field names of the DBF and also open indexes and determines automatically datatype, picture clause required, alignment of data (right alignment for numbers and dates and left alignment for other types), index orders to use for sorting, calculations for totalling, etc., incremental seeks, filters, etc. and also prepares a well tested codeblock for bOnPostEdit.
Please note that the codeblocks automatically generated by XBrowse for example bOnPostEdit, bSeek etc are well tested and much better than what you may write and even other wise there is no point in writing them for each column of each browse in your application when xbrowse does it automatically for you and that too bug-free.
You may even omit specifying column size and alignment because XBrowse automatically determines the best-fit.
Please note that you can enter complex expressions also inside the COLUMNS claiuse like "salary * 1.20", "Trim( First ) + ' ' + Trim( Last )", etc.
I assure you that you will get far better results by using COLUMNS clause for creating columns than oBrw:AddCol() and other methods of the column and all attendant disadvantages of this approach.
You liked to know how to use EDIT_BUTTON. This is used when you want a separate interface like a separate dialog to capture the new value.
Your function should accept the new value and return the new value. If you decide not to modify the value, you should retun NIL. You need to do all validations and use picture clauses, etc inside your function.
oCol := obrow:AddCol() oCol:bStrData := { ||oServer:QueryData("select unit from unit where itemid='"+odb2:itemid+"' and unitid='"+odb2:unitid+"'")} oCol:cHeader := "单位"
Hello I would suggest you AutoCode. Best regards, Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org https://www.facebook.com/groups/modharbour.club
********************************************************************