HwGUI 2.22: справочное руководство | ||
назад | Александр С. Кресин, Декабрь 2018 |
7. Утилиты
7.1. Дизайнер
The Designer is intended to create/modify input screen forms and reports. It's main features are:
- The controls set is fully configurable. The list of controls ( widgets ) is placed in a special configuration XML file. The name of that file is specified in Designer's ini file "Designer.iml", currently it is resource/widgets.xml. To add a new control or even a controls set, or add new properties/methods for a control is easy now - just edit the widgets.xml. This allows to use the Designer not only for HwGUI based, but for any other applications - you can create a fully new controls set for your purposes. Report items, for example, has been added with an additional resource file - resource/repwidg.xml.
- The Designer can be built not only as standalone program, but can be a part of other application where it is needed to edit forms and/or reports at runtime. There is a bat file bldlib.bat, which builds the designer.lib to link it in your application. To invoke the designer, you just need to call the function Designer():       Designer() - call Designer to open/create/edit any form ;       Designer( "-r" ) - call Designer to open/create/edit any report ;       Designer( "-s" ) - call Designer to create a new form ( doesn't allow to open any other ) ;       Designer( "-s",cForm ) - call Designer to edit a form 'cForm' ( doesn't allow to open any other ), the 'cForm' may be a file name or a string, containing the form ;       Designer( "-r","-s" ) - call Designer to create a new report ( doesn't allow to open any other ) ;       Designer( "-r","-s",cReport ) - call Designer to edit a report 'cReport' ( doesn't allow to open any other ), the 'cReport' may be a file name or a string, containing the report ;
- The output formats are configurable via the external scripts. The native HwGUI format support is included in Designer's code, all others are included as plugins. Currently there are three plugins - for reading old .frm files ( resource/f_text.prg ), for reading old .rpt files ( resource/r_text.prg ) and for writing the prgs - f_hwgprg.prg ( not fully functional yet ).
- Designer allows to set not only properties, but methods, too, - for every control / report item, so the resulting form description is a complete dialog procedure, and the resulting report description is a complete report program, which opens/navigates/closes databases, calculates summs, etc.
- HwGUI includes special classes to load / execute a form or report, created with the Designer - HFormTmpl, HRepTmpl.       oForm := HFormTmpl():Read( cForm ) - loads a form, 'cForm' may be a file name or a string, containing the form ;       oForm:Show() - executes the loaded form, shows it on the screen ;       oReport := HRepTmpl():Read( cReport ) - loads a report, 'cReport' may be a file name or a string, containing the report ;       oReport:Print( cPrinterName,lPreview ) - prints the report.
Few notes for HwGUI applications about using of some properties and methods:
- There is a method 'common' in a form methods list, it is intended for functions, which are needed for the form and which can be called from any other event handler of the form. Each function must be ended with the 'ENDFUNC' statement. The 'Return' isn't obligatory, but may be used if the function must return some value.
- The form has a property 'Variables' - it is an array of variables, which will be declared as 'Private' in the beginning of HFormTmpl():Show() and may be used in any event handler of the form.
- Each widget has a property 'Name' - this is a object name, which also will be declared as 'Private' in the beginning of HFormTmpl():Show().
- The widgets, which have corresponding 'GET' items, has a property 'Varname' - the name of the correspondibg variable, which also will be declared as 'Private' in the beginning of HFormTmpl():Show().
Few notes about the reports builder. For a few years there was another report designer in HwGUI - HwReport. Now the Designer becomes the main report builder utility. It has more modern and advanced engine than Hwreport and, what is important, it is more easy to support one engine than two different :). The important point is that now the report builder may be integrated into the application and it is convenient, IMO, that the same code, the same module, linked into the application, implements two tasks - works with input forms and with reports. The compatibility with the *.rpt files, created with Hwreport, is implemented via the plugin ( resource/r_text.prg ) - you may open rpt files, choosing the 'plain text format' and then save them in a new format, which is exactly the same as for input forms. The new report engine uses a bit different approach than the old one. There are no 'markers' - the widget 'area' is used instead. You can convert any rpt file into the new format and you will see how these 'areas' are used. The 'area' has two main properties:
- AreaType - it may be Table, DocHeader, DocFooter, PageHeader, PageFooter. The Table is the same as the space between 'Start line' and 'End line' markers in the old engine.
- VarOffset - False/True, it determines, if the area position on the paper is fixed ( False ), or it depends on the size of previous area ( True ).
- onRepInit, which is executed when the report starts ;
- onRepExit.
- onBegin - it is executed before the item is being printed ;
- Condition - it must return a logical value ( with the 'Return' statement ), which determines, should this item be printed or no ;
- onExit - it is executed after the item is being printed.
7.2. Tutorial
7.3. Отладчик
7.4. Текстовый редактор
7.5. Dbc
7.6. Менеджер бинарного контейнера
8. Contrib (Дополнительные модули)
8.1. ActiveX
8.2. Qhtm
8.2.1. Overview
QHTM is a C++ library, which allows
to display and print HTML content in your application - on any window,
device context, on a report, on a button or in a tooltip. For more details look at
http://www.gipsysoft.com.
HwGUI provides an interface for this library. To use it, you need to download
QHTM from the
http://www.gipsysoft.com/qhtm/freedownload.shtml and copy qhtm.dll to the same
directory, where your application is.
Attention !!! QHTM is released under other license
than Harbour and HwGUI, so don't forget to read it before using !
8.2.2. Commands
@ <x>,<y> QHTM [ <oQhtm> ] [ CAPTION <caption> ] [ FILE <fname> ] [ RESOURCE <resname> ] [ OF <oWnd> ]; [ ID <nId> ] [ SIZE <width>, <height> ] [ ON INIT <bInit> ] [ ON SIZE <bSize> ] [ ON CLICK <bLink> ] [ ON SUBMIT <bSubmit> ] [ STYLE <nStyle> ]
This command creates QHTM control. Html content may be assigned in three ways:
- You can write it after CAPTION clause.
- It may be in external html file, which name is designated after FILE clause.
- Resource file. In this case appropriate resource name is signed after RESOURCE clause.
REDEFINE QHTM [ <oQhtm> ] [ CAPTION <caption> ] [ FILE <fname> ] [ RESOURCE <resname> ] [ OF <oWnd> ]; ID <nId> [ ON INIT <bInit> ] [ ON SIZE <bSize> ] [ ON CLICK <bLink> ] [ ON SUBMIT <bSubmit> ]
This command redefines QHTM control from resources. Html content may be assigned in three ways the same three ways as in @ ... QHTM command.
@ <x>,<y> QHTMBUTTON [ <oButton> CAPTION ] <caption> [ OF <oWnd> ]; [ ID <nId> ] [ SIZE <width>, <height> ] [ ON INIT <bInit> ] [ ON SIZE <bSize> ] [ ON CLICK <bClick> ] [ STYLE <nStyle> ] [ FONT <oFont> ] [ TOOLTIP <ctoolt> ]
This command works exactly as @ ... BUTTON, but <caption> may include html content.
REDEFINE QHTMBUTTON <oButton> [ OF <oWnd> ] ID <nId> [ ON INIT <bInit> ] [ ON SIZE <bSize> ] [ ON CLICK <bClick> ] [ FONT <oFont> ] [ TOOLTIP <ctoolt> ]
This command works exactly as REDEFINE BUTTON, but <caption> may include html content.
8.2.3. Functions
QHTM_Init( [ cDllName ] )
QHTM_Message( cMessage [,cTitle ] [,nFlags ] )
QHTM_LoadFile( handle, cFileName )
QHTM_LoadRes( handle, cResourceName )
QHTM_AddHtml( handle, cText )
QHTM_GetTitle( handle )
QHTM_GetSize( handle )
QHTM_EnableCooltips()
QHTM_PrintCreateContext() --> hContext
QHTM_PrintSetText( hContext,cHtmlText )
QHTM_PrintSetTextFile( hContext,cFileName )
QHTM_PrintSetTextResource( hContext,cResourceName )
QHTM_PrintLayOut( hDC,hContext ) --> nNumberOfPages
QHTM_PrintPage( hDC,hContext,nPage )
QHTM_PrintDestroyContext( hContext )
9. Лицензия
HwGUI выпущен под той же лицензией, как и сам Harbour.
Эта программа является свободным программным обеспечением; вы можете распространять и/или изменять ее в соответствии с условиями Открытого лицензионного соглашения GNU, опубликованного Фондом свободного программного обеспечения; либо версии 2, либо любой более поздней версии по вашему выбору.
эта программа распространяется в надежде, что она будет полезной, но БЕЗ ЛЮБОЙ ГАРАНТИИ... Тьфу! Надоело переводить всю эту юридическую бредятину.
Смысл в том, что лицензия - GNU GPL, но с тем исключением, что если вы подключите HwGUI к другим файлам для получения исполняемого файла, это само по себе не вызовет того, что полученнный исполняемый файл тоже будет подчиняться, или, как еще говорят, будет инфицирован GNU GPL. Использование этого исполняемого файла не ограничено тем, что HwGUI входит в его состав.