Готовится к опубликованию новая сборка №48, которая выйдет в конце недели. Если у Вас есть интересные наработки для включения в новый релиз, то сейчас самое удобное время для их отправки мне
Кратко, что нового:
- исправление обнаруженных ошибок и неточностей кода; - новый класс HEADERIMAGE для Grid и Browse; - свойство Address в Hyperlink может теперь открывать папку или файл на диске; - добавлен NOTABSTOP класс для Browse; - поддержка пользовательских компонентов (заимствована из оффициального релиза); - расширения и исправления в библиотеках TsBrowse и PropGrid; - обновлены сборки Харбор и HMGS-IDE; - новые и обновленные старые примеры (как обычно ).
P.S. Пример очень лаконичный и насыщенный. Вот его краткое описание, сгенерированное ИИ:
цитата:
/* * Demonstrates the use of two TBrowse objects to display data from two related DBF files. * * Purpose: * This function creates a main window containing two TBrowse objects. Each TBrowse displays data from a different DBF file ("CUSTOMER2" accessed via aliases CUST1 and CUST2). * The TBrowse objects are related through a relation set up between the DBF files. * The function demonstrates how to use the _TBrowse() function to manage multiple TBrowse objects within a single window and how to switch focus between them using the TAB key. * It also shows how to handle the ESCAPE key to exit edit mode or close the window. * The function uses temporary DBF files created in memory to filter the data displayed in each TBrowse (one showing records where RecNo() % 2 != 0, the other where RecNo() % 2 == 0). * * Notes: * The function relies on the Sets_TSB() function to configure the TBrowse objects. * The CUSTOMER2.DBF file must exist in the same directory as the executable. * The temporary DBF files are deleted when the window is closed. */
gfilatov2002 Добавил в пример более широкую информацию в Title окна и SuperHeader тсб (просьба Андрея), + почистил код немного Положил на ftp PS Для понимания о чем речь (кому интересно), пример demo8.prg тут Скрытый текст
FUNCTION Main() LOCAL cForm := "wMain" LOCAL nY, nX, nH, nW LOCAL oTsb1, oTsb2, aFile := {}, cFile, aAls := {} LOCAL cAls1 := "CUST_1" , cAls2 := "CUST_2" LOCAL cDbf := "CUSTOMER2", cID := "CUSTNO" LOCAL cSel1 := "RecNo() %2 != 0" LOCAL cSel2 := "RecNo() %2 == 0" LOCAL cTitl := " Select, Relation and Edit. " + MiniGuiVersion()
Sets_TSB() // App.Cargo:oTsb create
cFile := App.Cargo:cPathDbf + cDbf
USE ( cFile ) ALIAS ( cAls1 ) NEW SHARED INDEX ON &cID TAG ID SET ORDER TO 1 GO TOP AAdd( aFile, Select2Mem(cSel1, cID) ) AAdd( aAls , StrTran(cAls1, "_", "") ) GO TOP
USE ( cFile ) ALIAS ( cAls2 ) NEW SHARED SET ORDER TO 1 GO TOP AAdd( aFile, Select2Mem(cSel2, cID) ) AAdd( aAls , StrTran(cAls2, "_", "") ) GO TOP
USE ( aFile[1] ) ALIAS ( aAls[1] ) NEW //SHARED SET RELATION TO ROWID INTO &cAls1 GO TOP USE ( aFile[2] ) ALIAS ( aAls[2] ) NEW //SHARED SET RELATION TO ROWID INTO &cAls2 GO TOP
DEFINE WINDOW &cForm TITLE "Demo 2 TBrowse." + cTitl ; MAIN NOSIZE TOPMOST ; ON INIT ( This.Topmost := .F., _wPost(0) ) ; ON RELEASE ( This.Hide, _wSend(90) ) This.Cargo := oHmgData()
ON KEY F1 ACTION NIL ON KEY TAB ACTION {|| Local ab := ThisWindow.Cargo:aBrw, ob Local nb := ThisWindow.Cargo:nBrw + 1 nb := iif( nb > Len(ab), 1, nb ) ob := ab[ nb ] ob:SetFocus() Return Nil } ON KEY ESCAPE ACTION {|| Local ab := ThisWindow.Cargo:aBrw, ob Local nb := ThisWindow.Cargo:nBrw ob := ab[ nb ] IF ob:IsEdit ; ob:SetFocus() ELSE ; _wSend(99) ENDIF Return Nil }
DO EVENTS nFld := FieldPos(cFld) GO TOP DO WHILE !EOF() DO EVENTS nRec := iif( EVal( bMode ), RecNo(), 0 ) IF nRec > 0 AAdd(aRecs, { FieldGet(nFld), Deleted() }) ENDIF SKIP ENDDO GO TOP DO EVENTS dbDrop(cFile, cFile, "DBFCDX") dbCreate( cFile, {{"ROWID", "N", 10, 0}}, "DBFCDX", .T., cAls + "_" ) FOR EACH aRec IN aRecs dbAppend() FieldPut(1, aRec[1]) IF ! Empty( aRec[2] ) ; dbDelete() ENDIF NEXT dbGoTop() dbCloseArea() dbSelectArea(nOld) DO EVENTS
RETURN cFile
STATIC FUNCTION Sets_TSB( oTsb ) LOCAL oac := App.Cargo
SET DECIMALS TO 4 SET EPOCH TO 2000 SET DATE TO GERMAN SET CENTURY ON SET DELETED OFF SET AUTOPEN ON SET EXACT ON SET EXCLUSIVE ON SET SOFTSEEK ON SET OOP ON SET TOOLTIPSTYLE BALLOON
SET MULTIPLE QUIT WARNING SET WINDOW MAIN OFF SET NAVIGATION EXTENDED SET WINDOW MODAL PARENT HANDLE ON //SET DEFAULT ICON TO "1MG" SET ShowRedAlert ON
/* * FUNCTION Main() * * Demonstrates the use of two TBrowse objects to display data from two related DBF files. * * Purpose: * This function creates a main window containing two TBrowse objects. Each TBrowse displays data from a different DBF file ("CUSTOMER2" accessed via aliases CUST1 and CUST2). * The TBrowse objects are related through a relation set up between the DBF files. * The function demonstrates how to use the _TBrowse() function to manage multiple TBrowse objects within a single window and how to switch focus between them using the TAB key. * It also shows how to handle the ESCAPE key to exit edit mode or close the window. * The function uses temporary DBF files created in memory to filter the data displayed in each TBrowse (one showing records where RecNo() % 2 != 0, the other where RecNo() % 2 == 0). * * Notes: * The function relies on the Sets_TSB() function to configure the TBrowse objects. * The CUSTOMER2.DBF file must exist in the same directory as the executable. * The temporary DBF files are deleted when the window is closed. */ FUNCTION Main() LOCAL cForm := "wMain" LOCAL nY, nX, nH, nW LOCAL oTsb1, oTsb2, aFile := {}, cFile, aAls := {} LOCAL cAls1 := "CUST_1" , cAls2 := "CUST_2" LOCAL cDbf := "CUSTOMER2", cID := "CUSTNO" LOCAL cSel1 := "RecNo() %2 != 0" LOCAL cSel2 := "RecNo() %2 == 0" LOCAL cTitl := " Select, Relation and Edit. " + MiniGuiVersion()
Sets_TSB() // App.Cargo:oTsb create
cFile := App.Cargo:cPathDbf + cDbf
USE ( cFile ) ALIAS ( cAls1 ) NEW SHARED INDEX ON &cID TAG ID SET ORDER TO 1 GO TOP AAdd( aFile, Select2Mem(cSel1, cID) ) AAdd( aAls , StrTran(cAls1, "_", "") ) GO TOP
USE ( cFile ) ALIAS ( cAls2 ) NEW SHARED SET ORDER TO 1 GO TOP AAdd( aFile, Select2Mem(cSel2, cID) ) AAdd( aAls , StrTran(cAls2, "_", "") ) GO TOP
USE ( aFile[1] ) ALIAS ( aAls[1] ) NEW SHARED SET RELATION TO ROWID INTO &cAls1 GO TOP USE ( aFile[2] ) ALIAS ( aAls[2] ) NEW SHARED SET RELATION TO ROWID INTO &cAls2 GO TOP
DEFINE WINDOW &cForm TITLE "Demo 2 TBrowse." + cTitl ; MAIN NOSIZE TOPMOST ; ON INIT ( This.Topmost := .F., _wPost(0) ) ; ON RELEASE ( This.Hide, _wSend(90) ) This.Cargo := oHmgData()
ON KEY F1 ACTION NIL ON KEY TAB ACTION {|| Local ab := ThisWindow.Cargo:aBrw, ob Local nb := ThisWindow.Cargo:nBrw + 1 nb := iif( nb > Len(ab), 1, nb ) ob := ab[ nb ] ob:SetFocus() Return Nil } ON KEY ESCAPE ACTION {|| Local ab := ThisWindow.Cargo:aBrw, ob Local nb := ThisWindow.Cargo:nBrw ob := ab[ nb ] IF ob:IsEdit ; ob:SetFocus() ELSE ; _wSend(99) ENDIF Return Nil }
/* * STATIC FUNCTION Select2Mem(lMode, cFld) * * Creates a temporary in-memory DBF file containing records from the current work area based on a filter condition. * * Parameters: * lMode (LOGICAL): If .T., selects records where RecNo() % 2 == 0. If .F., selects records where RecNo() % 2 != 0. * cFld (CHARACTER, optional): The field to copy to the new DBF. Defaults to "CUSTNO". * * Returns: * CHARACTER: The alias of the newly created in-memory DBF file (e.g., "mem:ALIAS"). * * Purpose: * This function is used to create temporary DBF files in memory that contain a subset of the data from an existing DBF file. * This allows for filtering and displaying specific records in TBrowse objects without modifying the original DBF file. * The function iterates through the records in the current work area, applies the filter condition based on lMode, and copies the specified field (cFld) and deletion status to the new in-memory DBF. * The new DBF file is created with a single field named "ROWID" of type Numeric. * * Notes: * The function uses the dbDrop() function to delete any existing DBF file with the same alias before creating the new one. * The function uses dbCreate() to create the new in-memory DBF file. * The function uses dbAppend() and FieldPut() to add records to the new DBF file. * The function uses dbDelete() to mark records as deleted in the new DBF file if they were deleted in the original DBF file. * The function restores the original work area after creating the new DBF file. */ STATIC FUNCTION Select2Mem(bMode, cFld) LOCAL nOld := Select() LOCAL aRecs := {}, cAls := Alias() LOCAL cFile := "mem:" + cAls, nFld, aRec, nRec Default cFld := "CUSTNO"
DO EVENTS nFld := FieldPos(cFld) GO TOP DO WHILE !EOF() DO EVENTS nRec := iif( EVal( bMode ), RecNo(), 0 ) IF nRec > 0 AAdd(aRecs, { FieldGet(nFld), Deleted() }) ENDIF SKIP ENDDO GO TOP DO EVENTS dbDrop(cFile, cFile, "DBFCDX") dbCreate( cFile, {{"ROWID", "N", 10, 0}}, "DBFCDX", .T., cAls + "_" ) FOR EACH aRec IN aRecs dbAppend() FieldPut(1, aRec[1]) IF ! Empty( aRec[2] ) ; dbDelete() ENDIF NEXT dbGoTop() dbCloseArea() dbSelectArea(nOld) DO EVENTS
RETURN cFile
/* * STATIC FUNCTION Sets_TSB( oTsb ) * * Configures default settings for TBrowse objects used in the application. * * Parameters: * oTsb (OBJECT, optional): An existing TBrowse object to configure. If NIL, a new oHmgData() object is created. * * Returns: * OBJECT: The configured TBrowse object (either the passed object or the newly created one). * * Purpose: * This function centralizes the configuration of common TBrowse settings, promoting code reuse and consistency. * It sets properties such as zebra striping, column numbering, and event handlers for initialization, after-browse operations, and focus changes. * The function also defines closures (code blocks) for customizing the appearance and behavior of the TBrowse objects. * This allows for dynamic modification of the TBrowse based on the data being displayed. * * Notes: * The function uses the App.Cargo object to store the TBrowse settings. * The bInit closure is responsible for loading the fields into the TBrowse and handling column customization. * The bAfter closure is responsible for customizing the appearance of the TBrowse after it has been loaded. * The bGotFocus closure is responsible for setting the focus to the TBrowse object and updating the window title. */ STATIC FUNCTION Sets_TSB( oTsb ) LOCAL oac := App.Cargo
Default oac:oTsb := oTsb, oac:oTsb := oHmgData()
oac:oTsb:aEdit := .F. oac:oTsb:aFoot := .T. oac:oTsb:lZebra := .T. oac:oTsb:aNumber := { 1, App.Object:W(0.5) } oac:oTsb:uSelector := 20 oac:oTsb:bInit := {|ob,op| Local cn := op:cAlsKey, lEdit, oc ob:Hide() lEdit := !Empty(op:lAlsEdit) ob:LoadFields(lEdit, op:aSelFld, op:cAlsFld) IF !Empty(cn) .and. ob:nColumn(cn, .T.) > 0 ob:DelColumn(cn) ENDIF IF lEdit ; ob:lRecLockArea := lEdit ENDIF Return Nil } oac:oTsb:bAfter := {|ob| Local oc := ob:aColumns[1] oc:nClrBack := {|na,nc,obr| Local ocol := obr:aColumns[nc] Local nclr := ocol:nClrHeadBack IF (obr:cAlias)->( Deleted() ) nclr := CLR_HGRAY na := nc ENDIF Return nclr } Return Nil } oac:oTsb:bGotFocus := {|ob| Local owc IF IsObject(ob) SET WINDOW THIS TO ob:cParentWnd owc := This.Cargo owc:nBrw := ob:Cargo:nBrw SET WINDOW THIS TO ENDIF Return Nil }
/* * INIT PROCEDURE Sets_ENV() * * Initializes the application environment, setting various system parameters and defining fonts. * * Purpose: * This procedure sets up the Harbour MiniGUI Extended Edition (HMG Extended) environment for the application. * It configures the default RDD (Replaceable Database Driver), date and time formats, display settings, and other system parameters. * It also defines custom fonts for use throughout the application, ensuring a consistent look and feel. * The procedure also sets up logging functionality, creating a log file to record application events and errors. * * Notes: * The procedure uses the rddSetDefault() function to set the default RDD to DBFCDX. * The procedure uses the SET command to configure various system parameters. * The procedure uses the _DefineFont() function to define custom fonts. * The procedure uses the _SetGetLogFile() function to set the log file. * The procedure uses the hb_FileDelete() function to delete the log file if it already exists. */ INIT PROCEDURE Sets_ENV() LOCAL cFont := "Arial", nSize := 12, oac
rddSetDefault( "DBFCDX" )
SET DECIMALS TO 4 SET EPOCH TO 2000 SET DATE TO GERMAN SET CENTURY ON SET DELETED OFF SET AUTOPEN ON SET EXACT ON SET EXCLUSIVE ON SET SOFTSEEK ON SET OOP ON SET TOOLTIPSTYLE BALLOON
SET MULTIPLE QUIT WARNING SET NAVIGATION EXTENDED SET WINDOW MODAL PARENT HANDLE ON SET ShowRedAlert ON
Отправлено: 10.07.25 14:28. Заголовок: gfilatov2002 пишет ..
gfilatov2002 пишет
цитата:
* STATIC FUNCTION Select2Mem(lMode, cFld) * * Creates a temporary in-memory DBF file containing records from the current work area based on a filter condition. * * Parameters: * lMode (LOGICAL): If .T., selects records where RecNo() % 2 == 0. If .F., selects records where RecNo() % 2 != 0. ...
Это место я поменял для индикации и более гибкого отбора на
STATIC FUNCTION Select2Mem(bMode, cFld) LOCAL nOld := Select() LOCAL aRecs := {}, cAls := Alias() LOCAL cFile := "mem:" + cAls, nFld, aRec, nRec Default cFld := "CUSTNO"
DO EVENTS nFld := FieldPos(cFld) GO TOP DO WHILE !EOF() DO EVENTS nRec := iif( EVal( bMode ), RecNo(), 0 ) IF nRec > 0 AAdd(aRecs, { FieldGet(nFld), Deleted() }) ENDIF SKIP ENDDO ...
т.е. можно задавать, например, в Main LOCAL cSel1 := "'BOX' $ upper(ADDR1)" //"RecNo() %2 != 0" LOCAL cSel2 := ... получим отбор из других, заданных условий PS Можно задавать поля для колонок тсб, переменные oTsb1:aSelFld := NIL // FieldNames relation, array oTsb2:aSelFld := NIL // FieldNames relation, array например oTsb1:aSelFld := {"COUNTRY", "STATE", "CITY", "COMPANY", "ADDR1"} oTsb2:aSelFld := {"COUNTRY", "STATE", "CITY", "COMPANY", "ADDR1"}
Отправлено: 10.07.25 15:19. Заголовок: SergKis пишет: Это ..
SergKis пишет:
цитата:
Это место я поменял
Поправил описание функции следующим образом:
цитата:
/* * STATIC FUNCTION Select2Mem(bMode, cFld) * * Creates a temporary in-memory DBF file containing records from the current work area based on a filter condition. * * Parameters: * bMode (BLOCK): A code block (closure) that defines the filter condition. It should evaluate to .T. for records to be included in the temporary DBF. * cFld (CHARACTER, optional): The field to copy to the new DBF. Defaults to "CUSTNO". * * Returns: * CHARACTER: The alias of the newly created in-memory DBF file (e.g., "mem:ALIAS"). * * Purpose: * This function is used to create temporary DBF files in memory that contain a subset of the data from an existing DBF file. * This allows for filtering and displaying specific records in TBrowse objects without modifying the original DBF file. * The function iterates through the records in the current work area, applies the filter condition defined by the bMode code block, and copies the specified field (cFld) and deletion status to the new in-memory DBF. * The new DBF file is created with a single field named "ROWID" of type Numeric. * This function is crucial for creating dynamic views of data based on specific criteria. * * Notes: * The function uses the dbDrop() function to delete any existing DBF file with the same alias before creating the new one. * The function uses dbCreate() to create the new in-memory DBF file. * The function uses dbAppend() and FieldPut() to add records to the new DBF file. * The function uses dbDelete() to mark records as deleted in the new DBF file if they were deleted in the original DBF file. * The function restores the original work area after creating the new DBF file. * The bMode parameter *must* be a valid code block that can be evaluated in the context of the current work area. */
ON KEY F1 ACTION NIL ON KEY TAB ACTION {|| Local ab := ThisWindow.Cargo:aBrw, ob Local nb := ThisWindow.Cargo:nBrw + 1 nb := iif( nb > Len(ab), 1, nb ) ob := ab[ nb ] ob:SetFocus() Return Nil } ON KEY ESCAPE ACTION {|| Local ab := ThisWindow.Cargo:aBrw, ob Local nb := ThisWindow.Cargo:nBrw ob := ab[ nb ] IF ob:IsEdit ; ob:SetFocus() ELSE ; _wSend(99) ENDIF Return Nil }
DO EVENTS nFld := FieldPos(cFld) GO TOP DO WHILE !EOF() DO EVENTS nRec := iif( EVal( bMode ), RecNo(), 0 ) IF nRec > 0 AAdd(aRecs, { RecNo(), Deleted() }) ENDIF SKIP ENDDO GO TOP DO EVENTS dbDrop(cFile, cFile, "DBFCDX") dbCreate( cFile, {{"ROWNR", "N", 10, 0}}, "DBFCDX", .T., cAls + "_" ) FOR EACH aRec IN aRecs dbAppend() FieldPut(1, aRec[1]) IF ! Empty( aRec[2] ) ; dbDelete() ENDIF NEXT dbGoTop() dbCloseArea() dbSelectArea(nOld) DO EVENTS
RETURN cFile
STATIC FUNCTION Sets_TSB( oTsb ) LOCAL oac := App.Cargo
SET DECIMALS TO 4 SET EPOCH TO 2000 SET DATE TO GERMAN SET CENTURY ON SET DELETED OFF SET AUTOPEN OFF SET EXACT ON SET EXCLUSIVE ON SET SOFTSEEK ON SET OOP ON SET TOOLTIPSTYLE BALLOON
SET MULTIPLE QUIT WARNING SET WINDOW MAIN OFF SET NAVIGATION EXTENDED SET WINDOW MODAL PARENT HANDLE ON //SET DEFAULT ICON TO "1MG" SET ShowRedAlert ON
/* * FUNCTION Main() * * Demonstrates the use of TBrowse controls with data selection, relation, and editing capabilities. * * Purpose: * This function demonstrates the use of two TBrowse controls to display and interact with data from a DBF file. * It performs the following steps: * 1. Sets up the TBrowse environment using Sets_TSB(). * 2. Opens two instances of the "CUSTOMER2" DBF file with different aliases and selection criteria. * 3. Creates two memory tables based on the selection criteria. * 4. Defines a main window with two TBrowse controls, each displaying data from one of the memory tables. * 5. Configures the TBrowse controls with specific properties, including aliases, relation fields, and editability. * 6. Sets up key bindings for navigation and exiting the application. * 7. Activates the main window, making it visible to the user. * * Notes: * - The "CUSTOMER2" DBF file is assumed to exist in the application's directory. * - The Sets_TSB() function is responsible for initializing the TBrowse environment and setting default properties. * - The Select2Mem() function creates a memory table based on a selection criteria. * - The application uses the App.Cargo object to store application-wide data, such as the TBrowse objects and file paths. */ FUNCTION Main() LOCAL cForm := "wMain" LOCAL nY, nX, nH, nW LOCAL oTsb1, oTsb2, aFile := {}, cFile, aAls := {} LOCAL cAls1 := "CUST_1" , cAls2 := "CUST_2" LOCAL cDbf := "CUSTOMER2", cID := "CUSTNO" LOCAL cSel1 := "RecNo() %2 != 0" LOCAL cSel2 := "RecNo() %2 == 0" LOCAL cTitl := " Select, Relation and Edit. " + MiniGuiVersion()
Sets_TSB() // App.Cargo:oTsb create
cFile := App.Cargo:cPathDbf + cDbf
USE ( cFile ) ALIAS ( cAls1 ) NEW SHARED AAdd( aFile, Select2Mem(cSel1, cID) ) AAdd( aAls , StrTran(cAls1, "_", "") ) GO TOP
USE ( cFile ) ALIAS ( cAls2 ) NEW SHARED AAdd( aFile, Select2Mem(cSel2, cID) ) AAdd( aAls , StrTran(cAls2, "_", "") ) GO TOP
USE ( aFile[1] ) ALIAS ( aAls[1] ) NEW GO TOP USE ( aFile[2] ) ALIAS ( aAls[2] ) NEW GO TOP
DEFINE WINDOW &cForm TITLE "Demo 2 TBrowse." + cTitl ; MAIN NOSIZE TOPMOST ; ON INIT ( This.Topmost := .F., _wPost(0) ) ; ON RELEASE ( This.Hide, _wSend(90) ) This.Cargo := oHmgData()
ON KEY F1 ACTION NIL ON KEY TAB ACTION {|| Local ab := ThisWindow.Cargo:aBrw, ob Local nb := ThisWindow.Cargo:nBrw + 1 nb := iif( nb > Len(ab), 1, nb ) ob := ab[ nb ] ob:SetFocus() Return Nil } ON KEY ESCAPE ACTION {|| Local ab := ThisWindow.Cargo:aBrw, ob Local nb := ThisWindow.Cargo:nBrw ob := ab[ nb ] IF ob:IsEdit ; ob:SetFocus() ELSE ; _wSend(99) ENDIF Return Nil }
/* * STATIC FUNCTION Select2Mem(bMode, cFld) * * Creates a memory table containing records selected from the current database based on a given condition. * * Parameters: * bMode (BLOCK or CHARACTER): A code block or character expression that defines the selection criteria. * If a code block, it should evaluate to .T. for records to be included. * If a character expression, it is converted to a code block. * cFld (CHARACTER, optional): The name of the field to be used as the ROWID in the memory table. Defaults to "CUSTNO". * * Returns: * CHARACTER: The alias of the newly created memory table. * * Purpose: * This function is used to create a temporary memory table containing a subset of records from a DBF file, * based on a specified selection criteria. This allows for filtering and manipulating data without directly * modifying the original DBF file. The memory table includes a "ROWNR" field that stores the original record number * from the DBF file, enabling a relation between the memory table and the original DBF. * * Notes: * - The function uses dbCreate() to create the memory table, which is automatically opened. * - The function uses dbAppend() and FieldPut() to add records to the memory table. * - The function uses dbDelete() to mark records as deleted in the memory table if they were deleted in the original DBF. * - The function uses dbDrop() to delete the memory table if it already exists. * - The function uses dbCloseArea() to close the memory table after it has been created. * - The function uses dbSelectArea() to restore the original selected work area. */ STATIC FUNCTION Select2Mem(bMode, cFld) LOCAL nOld := Select() LOCAL aRecs := {}, cAls := Alias() LOCAL cFile := "mem:" + cAls, nFld, aRec, nRec Default cFld := "CUSTNO"
DO EVENTS nFld := FieldPos(cFld) GO TOP DO WHILE !EOF() DO EVENTS nRec := iif( EVal( bMode ), RecNo(), 0 ) IF nRec > 0 AAdd(aRecs, { RecNo(), Deleted() }) ENDIF SKIP ENDDO GO TOP DO EVENTS dbDrop(cFile, cFile, "DBFCDX") dbCreate( cFile, {{"ROWNR", "N", 10, 0}}, "DBFCDX", .T., cAls + "_" ) FOR EACH aRec IN aRecs dbAppend() FieldPut(1, aRec[1]) IF ! Empty( aRec[2] ) ; dbDelete() ENDIF NEXT dbGoTop() dbCloseArea() dbSelectArea(nOld) DO EVENTS
RETURN cFile
/* * STATIC FUNCTION Sets_TSB( oTsb ) * * Configures the default settings and event handlers for TBrowse objects used in the application. * * Parameters: * oTsb (OBJECT, optional): An existing TBrowse object to configure. If not provided, a new oHmgData() object is created. * * Returns: * OBJECT: The configured TBrowse object (either the provided object or the newly created one). * * Purpose: * This function centralizes the configuration of TBrowse objects, ensuring consistency across the application. * It sets default properties such as editability, footer visibility, zebra striping, and column numbering. * It also defines event handlers for initialization, drawing lines, and gaining focus. * This function promotes code reusability and simplifies the creation of TBrowse controls. * * Notes: * - The function uses the App.Cargo object to store application-wide data, such as the default TBrowse settings. * - The bInit codeblock is executed when the TBrowse object is initialized. It loads the fields to be displayed and sets up the record locking area. * - The bOnDrawLine codeblock is executed when a line is drawn in the TBrowse object. It positions the cursor in the related DBF file. * - The bAfter codeblock is executed after the TBrowse object is displayed. It sets the background color of deleted records. * - The bGotFocus codeblock is executed when the TBrowse object gains focus. It sets the active window and updates the application's current TBrowse object. */ STATIC FUNCTION Sets_TSB( oTsb ) LOCAL oac := App.Cargo
DEFAULT oac:oTsb := oTsb, oac:oTsb := oHmgData()
oac:oTsb:aEdit := .F. oac:oTsb:aFoot := .T. oac:oTsb:lZebra := .T. oac:oTsb:aNumber := { 1, App.Object:W(0.5) } oac:oTsb:uSelector := 20 oac:oTsb:bInit := {|ob,op| Local cn := op:cAlsKey, lEdit, oc ob:Hide() lEdit := !Empty(op:lAlsEdit) ob:LoadFields(lEdit, op:aSelFld, op:cAlsFld) IF lEdit ; ob:lRecLockArea := lEdit ENDIF ob:bOnDrawLine := {|obr| Local cAls := obr:Cargo:oParam:cAlsFld (cAls)->( dbGoTo((obr:cAlias)->ROWNR) ) Return Nil } Return Nil } oac:oTsb:bAfter := {|ob| Local oc := ob:aColumns[1] oc:nClrBack := {|na,nc,obr| Local ocol := obr:aColumns[nc] Local nclr := ocol:nClrHeadBack IF (obr:cAlias)->( Deleted() ) nclr := CLR_HGRAY na := nc ENDIF Return nclr } Return Nil } oac:oTsb:bGotFocus := {|ob| Local owc IF IsObject(ob) SET WINDOW THIS TO ob:cParentWnd owc := This.Cargo owc:nBrw := ob:Cargo:nBrw SET WINDOW THIS TO ENDIF Return Nil }
/* * INIT PROCEDURE Sets_ENV() * * Initializes the application environment, setting various system settings and defining fonts. * * Purpose: * This procedure sets up the application's environment by configuring various system settings, * such as the default RDD, date format, decimal precision, and font settings. It also defines * application-specific settings, such as the log file path and whether to delete the log file on startup. * This ensures that the application runs consistently across different systems and configurations. * * Notes: * - The procedure sets the default RDD to DBFCDX, which is a common RDD for DBF files. * - The procedure sets the date format to German. * - The procedure sets various other system settings, such as SET DELETED OFF, SET EXACT ON, and SET SOFTSEEK ON. * - The procedure defines three fonts: "Normal", "Bold", and "Italic". * - The procedure creates an oHmgData() object and stores it in App.Cargo for application-wide data storage. * - The procedure sets the log file path and whether to delete the log file on startup. */ INIT PROCEDURE Sets_ENV() LOCAL cFont := "Arial", nSize := 12, oac
rddSetDefault( "DBFCDX" )
SET DECIMALS TO 4 SET EPOCH TO 2000 SET DATE TO GERMAN SET CENTURY ON SET DELETED OFF SET AUTOPEN OFF SET EXACT ON SET EXCLUSIVE ON SET SOFTSEEK ON SET OOP ON SET TOOLTIPSTYLE BALLOON
SET MULTIPLE QUIT WARNING SET NAVIGATION EXTENDED SET WINDOW MODAL PARENT HANDLE ON SET ShowRedAlert ON
Отправлено: 16.07.25 11:56. Заголовок: Доброго дня всем фор..
Доброго дня всем форумчанам . Давно не писал на Clipper/Harbour , а вот теперь снова понадобилось кой чего автоматизировать ... Подскажите , где сейчас находятся дистрибутивы Hаrbour и MiniGui ? Хочу установить всё для работы на новом компьютере .
Григорий, спасибо за новую версию! Перешел с версии 25.05 и обратил внимание, что картинки в меню поменяли фон. У меня в моих менюшках фон стал и белый и малиновый и черный.. Посмотреть пример - miniGui\SAMPLES\BASIC\MENU_Picture:
Отправлено: 10.09.25 11:18. Заголовок: Выяснил, что при зап..
Выяснил, что при запуске программы эти функции не портят алиас, но потом при открытии базы (стандартное открытие и создание индексов), начинается чехарда с этим алиасом, после вывода на экран - теряется алиас. Где и что происходит - не понимаю ?
Отправлено: 12.09.25 22:48. Заголовок: Обратите внимание на..
Обратите внимание на пример - SAMPLES\Advanced\Tsb_array_report Проба одного расчёта разными методами.
Отчёт по базе 2 млн. записей (1404 Мб. на диске HDD) считается за: SCOPE - время счёта 00:00:10.711 (10 секунд) - потрясающая скорость DoWhile -> Array - время счёта 00:00:57.393 - это тоже отличная скорость SCOPE + FILTER - время счёта 00:02:02.459 Условная индексация - время счёта 01:08:17.608
Все даты в формате GMT
3 час. Хитов сегодня: 10
Права: смайлы да, картинки да, шрифты да, голосования нет
аватары да, автозамена ссылок вкл, премодерация откл, правка нет