Готовится к опубликованию новая сборка №48, которая выйдет в конце недели. Если у Вас есть интересные наработки для включения в новый релиз, то сейчас самое удобное время для их отправки мне
Кратко, что нового:
- исправление обнаруженных ошибок и неточностей кода; - новый класс HEADERIMAGE для Grid и Browse; - свойство Address в Hyperlink может теперь открывать папку или файл на диске; - добавлен NOTABSTOP класс для Browse; - поддержка пользовательских компонентов (заимствована из оффициального релиза); - расширения и исправления в библиотеках TsBrowse и PropGrid; - обновлены сборки Харбор и HMGS-IDE; - новые и обновленные старые примеры (как обычно ).
*-----------------------------------------------------------------------------* FUNCTION _WindowCargo( FormName, xValue ) *-----------------------------------------------------------------------------* #ifdef _OBJECT_ LOCAL o := iif( HB_ISOBJECT( FormName ), FormName, _WindowObj( FormName ) ) LOCAL i := iif( HB_ISOBJECT( o ), o:Index, GetFormIndex( FormName ) ) #else LOCAL i := GetFormIndex( FormName ) #endif IF i > 0 IF PCount() > 1; _HMG_aFormMiscData2[ i ] := xValue Else ; RETURN _HMG_aFormMiscData2[ i ] ENDIF ENDIF
RETURN NIL
*-----------------------------------------------------------------------------* FUNCTION _ControlCargo( ControlName, FormName, xValue ) *-----------------------------------------------------------------------------* #ifdef _OBJECT_ LOCAL o := iif( HB_ISOBJECT( ControlName ), ControlName, _ControlObj( ControlName, FormName ) ) LOCAL i := iif( HB_ISOBJECT( o ), o:Index, GetControlIndex( ControlName, FormName ) ) #else LOCAL i := GetControlIndex( ControlName, FormName ) #endif IF i > 0 IF PCount() > 2; _HMG_aControlMiscData2[ i ] := xValue Else ; RETURN _HMG_aControlMiscData2[ i ] ENDIF ENDIF
RETURN NIL
#ifdef _OBJECT_
*-----------------------------------------------------------------------------* FUNCTION _WindowObj( FormName ) *-----------------------------------------------------------------------------* LOCAL h := iif( HB_ISNUMERIC( FormName ), FormName, GetFormHandle( FormName ) )
RETURN hmg_GetWindowObject( h )
*-----------------------------------------------------------------------------* FUNCTION _ControlObj( ControlName, FormName ) *-----------------------------------------------------------------------------* LOCAL h := iif( HB_ISNUMERIC( ControlName ), ControlName, ; GetControlHandle( ControlName, FormName ) )
RETURN hmg_GetWindowObject( h )
*-----------------------------------------------------------------------------* FUNCTION Do_ControlEventProcedure ( bBlock, i, p1, p2, p3, p4 ) *-----------------------------------------------------------------------------* LOCAL RetVal
*-----------------------------------------------------------------------------* FUNCTION Do_WindowEventProcedure ( bBlock, i, p1, p2, p3, p4 ) *-----------------------------------------------------------------------------* LOCAL RetVal
IF HB_ISBLOCK( bBlock ) .AND. i > 0
_PushEventInfo()
_HMG_ThisFormIndex := i _HMG_ThisEventType := '' _HMG_ThisType := 'W' _HMG_ThisIndex := i _HMG_ThisFormName := _HMG_aFormNames[ _HMG_ThisFormIndex ] _HMG_ThisControlName := ""
RetVal := Eval( bBlock, p1, p2, p3, p4 )
_PopEventInfo()
ENDIF
RETURN RetVal
*-----------------------------------------------------------------------------* FUNC Do_OnWndInit( i, cVar ) *-----------------------------------------------------------------------------* LOCAL nIndex := i LOCAL cName := _HMG_aFormNames[ i ] LOCAL nHandle := _HMG_aFormHandles[ i ] LOCAL nParent := _HMG_aFormParentHandle[ i ] LOCAL cType := _HMG_aFormType[ i ]
*-----------------------------------------------------------------------------* FUNC Do_OnWndRelease( i ) *-----------------------------------------------------------------------------* LOCAL o LOCAL hWnd := _HMG_aFormHandles[ i ]
IF hmg_IsWindowObject( hWnd ) o := hmg_GetWindowObject( hWnd ) IF __objHasMethod( o, 'Del' ); o:Del() ENDIF IF __objHasMethod( o, 'Destroy' ); o:Destroy() ENDIF RETURN .T. ENDIF
RETURN .F.
*-----------------------------------------------------------------------------* FUNC Do_OnCtlInit( i, cVar ) *-----------------------------------------------------------------------------* LOCAL nCtlIndex := i LOCAL cCtlName := _HMG_aControlNames[ i ] LOCAL nHandle := iif( ISARRAY( _HMG_aControlHandles[ i ] ), ; _HMG_aControlHandles[ i ][ 1 ], _HMG_aControlHandles[ i ] ) LOCAL nParent := _HMG_aControlParentHandles[ i ] LOCAL cFormName := GetParentFormName( i ) LOCAL cCtlType := iif( Empty( cFormName ), _HMG_aControlType[ i ], ; GetProperty( cFormName, cCtlName, "Type" ) )
*-----------------------------------------------------------------------------* FUNC Do_OnCtlRelease( i, p ) *-----------------------------------------------------------------------------* LOCAL o LOCAL hWnd := _HMG_aControlHandles[ i ]
IF hmg_IsWindowObject( hWnd ) .AND. _HMG_aFormType[ p ] != 'M' o := hmg_GetWindowObject( hWnd ) IF __objHasMethod( o, 'Del' ); o:Del() ENDIF IF __objHasMethod( o, 'Destroy' ); o:Destroy() ENDIF RETURN .T. ENDIF
*-----------------------------------------------------------------------------* FUNCTION GetControlIndex ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* LOCAL mVar
*-----------------------------------------------------------------------------* FUNCTION GetControlName ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* LOCAL i
IF ( i := GetControlIndex ( ControlName, ParentForm, Index ) ) == 0 RETURN '' ENDIF
RETURN ( _HMG_aControlNames [ i ] )
*-----------------------------------------------------------------------------* FUNCTION GetControlHandle ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* LOCAL i
IF ( i := GetControlIndex ( ControlName, ParentForm, Index ) ) == 0 MsgMiniGuiError ( "Control " + ControlName + " Of " + ParentForm + " Not defined." ) ENDIF
RETURN ( _HMG_aControlHandles [ i ] )
*-----------------------------------------------------------------------------* FUNCTION GetControlContainerHandle ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* LOCAL i
IF ( i := GetControlIndex ( ControlName, ParentForm, Index ) ) == 0 RETURN 0 ENDIF
RETURN ( _HMG_aControlContainerHandle [ i ] )
*-----------------------------------------------------------------------------* FUNCTION GetControlParentHandle ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* LOCAL i
IF ( i := GetControlIndex ( ControlName, ParentForm, Index ) ) == 0 RETURN 0 ENDIF
RETURN ( _HMG_aControlParentHandles [ i ] )
*-----------------------------------------------------------------------------* FUNCTION GetControlId ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* LOCAL i
IF ( i := GetControlIndex ( ControlName, ParentForm, Index ) ) == 0 RETURN 0 ENDIF
RETURN ( _HMG_aControlIds [ i ] )
*-----------------------------------------------------------------------------* FUNCTION GetControlType ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* LOCAL i
IF ( i := GetControlIndex ( ControlName, ParentForm, Index ) ) == 0 RETURN '' ENDIF
RETURN ( _HMG_aControlType [ i ] )
*-----------------------------------------------------------------------------* FUNCTION GetControlValue ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* LOCAL i
IF ( i := GetControlIndex ( ControlName, ParentForm, Index ) ) == 0 RETURN Nil ENDIF
RETURN ( _HMG_aControlValue [ i ] )
*-----------------------------------------------------------------------------* FUNCTION GetControlPageMap ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* LOCAL i
IF ( i := GetControlIndex ( ControlName, ParentForm, Index ) ) == 0 RETURN {} ENDIF
RETURN ( _HMG_aControlPageMap [ i ] )
*-----------------------------------------------------------------------------* FUNCTION _SetFocus ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* LOCAL MaskStart As Numeric // LOCAL H , T , x , i , ControlCount , ParentFormHandle LOCAL H , T , x , ControlCount , ParentFormHandle LOCAL i := GetControlIndex ( ControlName, ParentForm, Index )
H := GetControlHandle( ControlName, ParentForm, i ) T := GetControlType ( ControlName, ParentForm, i ) // i := GetControlIndex ( ControlName, ParentForm ) ...
*-----------------------------------------------------------------------------* FUNCTION _DisableControl ( ControlName , ParentForm , nPosition, Index ) *-----------------------------------------------------------------------------* // LOCAL T , c , y , s , z , w LOCAL T , c , s , z , w LOCAL y := GetControlIndex ( ControlName, ParentForm, Index )
T := GetControlType ( ControlName, ParentForm, y ) c := GetControlHandle ( ControlName, ParentForm, y ) // y := GetControlIndex ( ControlName, ParentForm ) ...
*-----------------------------------------------------------------------------* FUNCTION _EnableControl ( ControlName , ParentForm , nPosition, Index ) *-----------------------------------------------------------------------------* // LOCAL t , c , y , s , z , w LOCAL t , c , s , z , w LOCAL y := GetControlIndex ( ControlName, ParentForm, Index )
T := GetControlType ( ControlName, ParentForm, y ) c := GetControlHandle ( ControlName, ParentForm, y ) // y := GetControlIndex ( ControlName, ParentForm ) ...
*-----------------------------------------------------------------------------* FUNCTION _ShowControl ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* // LOCAL t, i, c, w, s, y, z, r LOCAL t, i, c, w, s, z, r LOCAL y := GetControlIndex ( ControlName, ParentForm, Index ) LOCAL TabHide := .F.
T := GetControlType ( ControlName, ParentForm, y ) c := GetControlHandle ( ControlName, ParentForm, y ) // y := GetControlIndex ( ControlName, ParentForm ) ...
*-----------------------------------------------------------------------------* FUNCTION _HideControl ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* // LOCAL t, c, y, r, w, z LOCAL t, c, r, w, z LOCAL y := GetControlIndex ( ControlName, ParentForm, Index )
T := GetControlType ( ControlName, ParentForm, y ) c := GetControlHandle ( ControlName, ParentForm, y ) // y := GetControlIndex ( ControlName, ParentForm ) ...
*-----------------------------------------------------------------------------* FUNCTION _SetPicture ( ControlName, ParentForm, FileName, Index ) *-----------------------------------------------------------------------------* // LOCAL w, h, t, i, c, cImage, oGet LOCAL w, h, t, c, cImage, oGet LOCAL i := GetControlIndex ( ControlName, ParentForm, Index )
c := GetControlHandle ( ControlName, ParentForm, i ) // i := GetControlIndex ( ControlName, ParentForm ) t := GetControlType ( ControlName, ParentForm, i ) ...
*-----------------------------------------------------------------------------* FUNCTION _GetPicture ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* LOCAL i := GetControlIndex ( ControlName, ParentForm, Index ) ...
Я понимаю Вашу логику, чтобы добавить дополнительный параметр Index, как это сделано в функциях _getvalue() и _setvalue() Но без острой необходимости не хотелось бы усложнять существующую логику, которая опирается на использование только ControlName и ParentForm параметров в большинстве других внутренних функций. Поэтому пока Ваше предложение не принято...
SergKis
постоянный участник
Пост N: 1577
Зарегистрирован: 17.02.12
Отправлено: 10.07.17 12:19. Заголовок: gfilatov2002 пишет н..
gfilatov2002 пишет
цитата:
не хотелось бы усложнять существующую логику, которая опирается на использование только ControlName и ParentForm параметров в большинстве других внутренних функций
Основной целью предложения - это исп. в классах, т.к. там индекс известен и сразу может указываться в вызовах.
gfilatov2002
moderator
Пост N: 1136
Зарегистрирован: 11.02.10
Отправлено: 11.07.17 16:42. Заголовок: SergKis Возник вопр..
SergKis Возник вопрос после небольшой проверки использоапния ООП в базовом примере MAIN_DEMO. Добавил в главное меню такую строчку
После запуска примера эта команда показывает используемые типы элементов управления главного окна, как и ожидалось. Но еслм, напрмер, открыть и затем закрыть дочернее окно из пункта меню 'More Tests', то все эти элементы управления, которые показывала добавленная в меню команда, стираются из переменной ::oName В чем состоит моя ошибка и как это исправить
SergKis
постоянный участник
Пост N: 1580
Зарегистрирован: 17.02.12
Отправлено: 11.07.17 20:30. Заголовок: gfilatov2002 пишет В..
gfilatov2002 пишет
цитата:
В чем состоит моя ошибка и как это исправить
тут моя ошибка, красным лишнее (убираться должно только в destroy() окна)
Благодарю за исправление! Сейчас после закрытия дочерних окон все в порядке
Но если вызвать окно предварительного просмотра печати из главного окна, то после закрытия этого окна просмотра снова будет стерто содержимое переменной ::oName
SergKis пишет:
цитата:
нужна Ваша сборка hmg
Завтра отправлю ссылку на Ваш почтовый адрес <bilance[at]bilance.lv>
SergKis
постоянный участник
Пост N: 1582
Зарегистрирован: 17.02.12
Отправлено: 11.07.17 21:34. Заголовок: gfilatov2002 пишет З..
gfilatov2002 пишет
цитата:
Завтра отправлю ссылку на Ваш почтовый адрес <bilance[at]bilance.lv>
Лучше в личку, почты с собой нет, с работой общаюсь, через ftp
Отправлено: 12.07.17 11:33. Заголовок: gfilatov2002 пишет О..
gfilatov2002 пишет
цитата:
Отправил ссылку ы Л.С.
Спасибо, забрал и по ситуации с FUNCTION PRINTPIE, где печать Preview, можно глубже лезть, но, возможно есть еще окна такого типа, предложение для них делать, как я сделал в примере:
*------------------------------------------------------------------------------* FUNCTION PRINTPIE *------------------------------------------------------------------------------* ... LOCAL lOOP := _HMG_lOOPEnabled
If lOOP SET OOP OFF EndIf
SET FONT TO _GetSysFont() , 8 ... SET FONT TO _GetSysFont() , GetDefaultFontSize()
If lOOP SET OOP ON EndIf
RETURN NIL и в таком случае, немного подправить команду SET OOP <еще от переменной, кроме ON\OFF>
еще предложение добавить функцию *------------------------------------------------------------------------------* FUNC Do_Obj( nHandle, bBlock, p1, p2, p3 ) *------------------------------------------------------------------------------* LOCAL o
If hmg_IsWindowObject(nHandle) o := hmg_GetWindowObject(nHandle) If HB_ISBLOCK(bBlock) RETURN Eval( bBlock, o, p1, p2, p3 ) EndIf Endif
RETURN o т.е. объект независимо от ф-ий _ControlObj(...), _WindowObj(...), определяем в блоке кода принадлежность IsWindow\IsControl
SergKis
постоянный участник
Пост N: 1584
Зарегистрирован: 17.02.12
Отправлено: 12.07.17 11:50. Заголовок: PS Добавил в пример ..
PS Добавил в пример
@ 140,10 BUTTONEX Button_00 ; CAPTION 'Capture Form' ; ON CLICK SaveWindow ( 'Form_1' ) ; TOOLTIP 'Save Form to BMP file'
@ 140,10+This.Button_00.Width+2 BUTTONEX Button_000 ; CAPTION 'All Type' ; ON CLICK MsgDebug( (This.Object):GetListType(), 'ALL TYPE' ) ; WIDTH 80 ; TOOLTIP 'All type for window'
@ 170,10 BUTTONEX Button_0 ;
Для демонстрации наследования. Т.е. в контроле применяем метод прописанный в окне. Списки (:GetListType(), :GetObj4Type( cType, lEque ), :GetObj4Name( cName )) можно получать и на контролах
FUNCTION _ReleaseWindow ( FormName ) ... FormHandle := _HMG_aFormHandles [ i ]
* Release Window // с этой вставкой
IF _HMG_lOOPEnabled Eval ( _HMG_bOnFormDestroy, i ) ENDIF
IF _HMG_aFormType [ i ] == 'M' .AND. _HMG_ActiveModalHandle <> FormHandle ... т.к. далее идет PostMessage ( FormHandle, WM_CLOSE, 0, 1 ) а в Events(...) CASE WM_CLOSE ... есть обработка SWITCH _HMG_InteractiveClose т.е. может быть отказ от закрытия окна. поэтому, выделенный код, надо, перенести в Events() line 3378 ELSE
IF ISBLOCK( _HMG_aFormReleaseProcedure [ i ] )
_HMG_InteractiveCloseStarted := .T. _DoWindowEventProcedure ( _HMG_aFormReleaseProcedure [ i ] , i , 'WINDOW_RELEASE' )
ENDIF
_hmg_OnHideFocusManagement ( i ) // эта строка сначала или выделенный код ниже ? т.е поменять местами ?
IF _HMG_lOOPEnabled Eval ( _HMG_bOnFormDestroy, i ) ENDIF
ENDIF ... тогда в FUNC Do_OnCtlRelease( i, p ) можно убрать IF hmg_IsWindowObject( hWnd ) // .AND. _HMG_aFormType[ p ] != 'M'
Все даты в формате GMT
3 час. Хитов сегодня: 217
Права: смайлы да, картинки да, шрифты да, голосования нет
аватары да, автозамена ссылок вкл, премодерация откл, правка нет