Автор | Сообщение |
gfilatov
|
| модератор
|
Пост N: 699
Зарегистрирован: 25.05.05
|
|
Отправлено: 29.01.08 13:59. Заголовок: Новая версия Расширенного релиза библиотеки MiniGUI (часть VI ) (продолжение)
Начало темы находится здесь, а теперь АНОНС * АНОНС * АНОНС * АНОНС * АНОНС Готовится к опубликованию новая сборка №48, которая выйдет в конце недели. Если у Вас есть интересные наработки для включения в новый релиз, то сейчас самое удобное время для их отправки мне Кратко, что нового: - исправление обнаруженных ошибок и неточностей кода; - новый класс HEADERIMAGE для Grid и Browse; - свойство Address в Hyperlink может теперь открывать папку или файл на диске; - добавлен NOTABSTOP класс для Browse; - поддержка пользовательских компонентов (заимствована из оффициального релиза); - расширения и исправления в библиотеках TsBrowse и PropGrid; - обновлены сборки Харбор и HMGS-IDE; - новые и обновленные старые примеры (как обычно ).
| |
|
Ответов - 300
, стр:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
All
[только новые]
|
|
gfilatov2002
|
| moderator
|
Пост N: 1131
Зарегистрирован: 11.02.10
|
|
Отправлено: 05.07.17 22:46. Заголовок: И еще файл h_objmisc..
И еще файл h_objmisc.prg Скрытый текст
/* * MINIGUI - Harbour Win32 GUI library source code * */ #include "minigui.ch" *-----------------------------------------------------------------------------* 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 IF HB_ISBLOCK( bBlock ) .AND. i > 0 _PushEventInfo() _HMG_ThisFormIndex := AScan ( _HMG_aFormHandles, _HMG_aControlParentHandles[ i ] ) _HMG_ThisType := 'C' _HMG_ThisIndex := i _HMG_ThisFormName := _HMG_aFormNames[ _HMG_ThisFormIndex ] _HMG_ThisControlName := _HMG_aControlNames[ _HMG_ThisIndex ] RetVal := Eval( bBlock, p1, p2, p3, p4 ) _PopEventInfo() ENDIF RETURN 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 ] RETURN oWndData( nIndex, cName, nHandle, nParent, cType, cVar ) *-----------------------------------------------------------------------------* 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" ) ) RETURN oCnlData( nCtlIndex, cCtlName, nHandle, nParent, cCtlType, cVar ) *-----------------------------------------------------------------------------* 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 RETURN .F. *-----------------------------------------------------------------------------* FUNC Do_OnWndLaunch( hWnd, nMsg, wParam, lParam ) *-----------------------------------------------------------------------------* IF hmg_IsWindowObject ( hWnd ) hmg_GetWindowObject( hWnd ):DoEvent( wParam, lParam ) ENDIF HB_SYMBOL_UNUSED( nMsg ) RETURN NIL *-----------------------------------------------------------------------------* FUNC Do_OnCtlLaunch( hWnd, nMsg, wParam, lParam ) *-----------------------------------------------------------------------------* IF ! Empty( lParam ); hWnd := lParam ENDIF IF hmg_IsWindowObject ( hWnd ) hmg_GetWindowObject( hWnd ):DoEvent( wParam, lParam ) ENDIF HB_SYMBOL_UNUSED( nMsg ) RETURN NIL #pragma BEGINDUMP #include <mgdefs.h> #include "hbapiitm.h" #include <commctrl.h> HB_FUNC( HMG_SETWINDOWOBJECT ) { PHB_ITEM pObject; HWND hWnd = ( HWND ) HB_PARNL( 1 ); if( IsWindow( hWnd ) ) { pObject = ( PHB_ITEM ) hb_param( 2, HB_IT_OBJECT ); if( pObject && HB_IS_OBJECT( pObject ) ) { pObject = hb_itemNew( pObject ); hb_gcLock( pObject ); // Ref++ SetWindowLongPtr( hWnd, GWLP_USERDATA, ( LPARAM ) pObject ); hb_retl( TRUE ); return; } } hb_retl( FALSE ); } HB_FUNC( HMG_DELWINDOWOBJECT ) { PHB_ITEM pObject; HWND hWnd = ( HWND ) HB_PARNL( 1 ); if( IsWindow( hWnd ) ) { pObject = ( PHB_ITEM ) GetWindowLongPtr( hWnd, GWLP_USERDATA ); SetWindowLongPtr( hWnd, GWLP_USERDATA, 0 ); if( pObject && HB_IS_OBJECT( pObject ) ) { hb_gcUnlock( pObject ); // Ref -- hb_itemRelease( pObject ); } } } HB_FUNC( HMG_GETWINDOWOBJECT ) { HWND hWnd = ( HWND ) HB_PARNL( 1 ); if( ! IsWindow( hWnd ) ) { hb_ret(); return; } hb_itemReturn( ( PHB_ITEM ) GetWindowLongPtr( hWnd, GWLP_USERDATA ) ); } HB_FUNC( HMG_ISWINDOWOBJECT ) { PHB_ITEM pObject; HWND hWnd = ( HWND ) HB_PARNL( 1 ); if( ! IsWindow( hWnd ) ) { hb_retl( FALSE ); return; } pObject = ( PHB_ITEM ) GetWindowLongPtr( hWnd, GWLP_USERDATA ); if( ! pObject ) { hb_retl( FALSE ); return; } if( ! HB_IS_OBJECT( pObject ) ) { hb_retl( FALSE ); return; } hb_retl( TRUE ); } #pragma ENDDUMP #endif
| Возможно, Вы захотите указать также свой копирайт в этих файлах
| |
|
SergKis
|
| постоянный участник
|
Пост N: 1570
Зарегистрирован: 17.02.12
|
|
Отправлено: 06.07.17 22:02. Заголовок: gfilatov2002 неболь..
gfilatov2002 небольшие изменения Скрытый текст
h_objmisc.prg было FUNC Do_OnCtlInit( i, cVar ) стало FUNC Do_OnCnlInit( i, cVar ) было FUNC Do_OnCtlRelease( i, p ) стало FUNC Do_OnCnlRelease( i, p ) проглядел t вместо n. Контрол это Cnl был, а Ctl вроде как каталог ? h_object.prg CLASS TWndData ... VAR cChr INIT ',' VAR oOnEventBlock AS OBJECT CLASSDATA oProp AS OBJECT INIT oKeyData() ... METHOD Def( nIndex, cName, nHandle, nParent, cType, cVar ) INLINE ( ; ... ::oEvent := oKeyData( Self ), ; ::oOnEventBlock := oKeyData(Self, .T.), ; hmg_SetWindowObject( ::nHandle, Self ), ; Self ) ... ASSIGN Chr( cChr ) INLINE ::cChr := iif( HB_ISCHAR( cChr ), cChr, ::cChr ) ACCESS bOnEvent INLINE ::oOnEventBlock ACCESS WM_nMsgW INLINE WM_WND_LAUNCH ... // Destructor METHOD Destroy() INLINE ( ; ::oCargo := iif( HB_ISOBJECT(::oCargo ), ::oCargo:Destroy() , Nil ), ; ::oEvent := iif( HB_ISOBJECT(::oEvent ), ::oEvent:Destroy() , Nil ), ; ::oOnEventBlock := iif( HB_ISOBJECT(::oOnEventBlock), ::oOnEventBlock:Destroy(), Nil ), ; ::oName := iif( HB_ISOBJECT(::oName ), ::oName:Destroy() , Nil ), ; ::oHand := iif( HB_ISOBJECT(::oHand ), ::oHand:Destroy() , Nil ), ; ::oProp := iif( HB_ISOBJECT(::oProp ), ::oProp:Destroy() , Nil ), ; ::oUserKeys := iif( HB_ISOBJECT(::oUserKeys ), ::oUserKeys:Destroy() , Nil ), ; ::nIndex := ::nParent := ::cType := ::cName := ::cVar := ::cChr := Nil, ; hmg_DelWindowObject( ::nHandle ), ::nHandle := Nil ) #ifdef __XHARBOUR__ ... CLASS TCnlData INHERIT TWndData ... // Destructor METHOD Destroy() INLINE ( ::Del(), ; ::oCargo := iif( HB_ISOBJECT(::oCargo ) , ::oCargo:Destroy() , Nil ), ; ::oEvent := iif( HB_ISOBJECT(::oEvent ) , ::oEvent:Destroy() , Nil ), ; ::oOnEventBlock := iif( HB_ISOBJECT(::oOnEventBlock ), ::oOnEventBlock:Destroy(), Nil ), ; ::oName := iif( HB_ISOBJECT(::oName ) , ::oName:Destroy() , Nil ), ; ::oHand := iif( HB_ISOBJECT(::oHand ) , ::oHand:Destroy() , Nil ), ; ::oUserKeys := iif( HB_ISOBJECT(::oUserKeys) , ::oUserKeys:Destroy() , Nil ), ; ::nParent := ::nIndex := ::cName := ::cType := ::cVar := ::cChr := Nil, ; hmg_DelWindowObject( ::nHandle ), ::nHandle := Nil ) #ifdef __XHARBOUR__ ... CLASS TTsbData INHERIT TCnlData ... ACCESS Tsb INLINE ::oTBrowse METHOD OnEvent( nMsg, wParam, lParam ) INLINE ::Tsb:HandleEvent( nMsg, wParam, lParam ) METHOD Destroy() INLINE ::oTBrowse := ::Super:Destroy() ENDCLASS CLASS TWmEData ... METHOD Do( nMsg, wParam, lParam ) CLASS TWmEData ... IF HB_ISBLOCK( b ) o := ::oObj IF o:IsWindow ... если надо, пусть будет Copyright 2017 Aleksandr Belov, Sergej Kiselev <bilance@bilance.lv> или <clipper.borda.ru>
| Пока остановлюсь с изменениями, надо посмотреть что получилось в реальности.
| |
|
gfilatov2002
|
| moderator
|
Пост N: 1132
Зарегистрирован: 11.02.10
|
|
Отправлено: 06.07.17 22:22. Заголовок: SergKis пишет: Конт..
SergKis пишет: цитата: | Контрол это Cnl был, а Ctl вроде как каталог ? |
| Нет, это было сделано намеренно. Сокращение Ctl используется для обозначения контрола (см. название системной библиотеки comctl32.dll) SergKis пишет: цитата: | VAR oOnEventBlock AS OBJECT |
| Благодарю! Уже сделал эти правки - посмотрел в Вашем описании работы с классами SergKis пишет: цитата: | METHOD Destroy() INLINE ( ::Del(), |
| Этот метод также уже поправил ... SergKis пишет: цитата: | Copyright 2017 Aleksandr Belov, Sergej Kiselev <bilance@bilance.lv> |
|
| |
|
SergKis
|
| постоянный участник
|
Пост N: 1571
Зарегистрирован: 17.02.12
|
|
Отправлено: 07.07.17 13:20. Заголовок: gfilatov2002 Можно ..
gfilatov2002 Можно ли добавить в TsBrowse переменную для запрета работы метода KeyChar(...) ? VAR lNoKeyChar INIT .F. и METHOD KeyChar( nKey, nFlags ) CLASS TSBrowse ... Default ::nUserKey := nKey If ::nUserKey == 255 .or. :lNoKeyChar // from KeyDown() method Return 0 EndIf If ::lAppendMode ... мучить все время :nUserKey := 255 неудобно.
| |
|
gfilatov2002
|
| moderator
|
Пост N: 1133
Зарегистрирован: 11.02.10
|
|
Отправлено: 07.07.17 13:52. Заголовок: SergKis пишет: Можн..
SergKis пишет: цитата: | Можно ли добавить в TsBrowse переменную для запрета работы метода KeyChar |
| Благодарю за предложение! Если надо, то, конечно, добавлю
| |
|
SergKis
|
| постоянный участник
|
Пост N: 1572
Зарегистрирован: 17.02.12
|
|
Отправлено: 07.07.17 18:07. Заголовок: gfilatov2002 пишет Е..
gfilatov2002 пишет цитата: | Если надо, то, конечно, добавлю |
| Это надо при работе с ячейками и lEdit := .T., но не надо вкл. Edit от нажатий цифр\букв.
| |
|
gfilatov2002
|
| moderator
|
Пост N: 1134
Зарегистрирован: 11.02.10
|
|
Отправлено: 07.07.17 22:05. Заголовок: SergKis пишет: Это ..
SergKis пишет: цитата: | Это надо при работе с ячейками и lEdit := .T. |
| Понятно, я уже добавил этот переключатель
| |
|
SergKis
|
| постоянный участник
|
Пост N: 1576
Зарегистрирован: 17.02.12
|
|
Отправлено: 09.07.17 17:39. Заголовок: gfilatov2002 Предло..
gfilatov2002 Предложение Скрытый текст
h_controlmisc.prg *-----------------------------------------------------------------------------* FUNCTION GetControlIndex ( ControlName, ParentForm, Index ) *-----------------------------------------------------------------------------* LOCAL mVar IF HB_ISNUMERIC ( Index ); RETURN Index ENDIF mVar := '_' + ParentForm + '_' + ControlName IF __mvExist ( mVar ) RETURN __mvGet ( mVar ) ENDIF RETURN 0 *-----------------------------------------------------------------------------* 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 ) ...
| Если это интересно, можно еще поискать места.
| |
|
gfilatov2002
|
| moderator
|
Пост N: 1135
Зарегистрирован: 11.02.10
|
|
Отправлено: 10.07.17 12:06. Заголовок: SergKis пишет: Пред..
SergKis пишет: Я понимаю Вашу логику, чтобы добавить дополнительный параметр 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. Добавил в главное меню такую строчку цитата: | ITEM 'ALL TYPE' ACTION MsgDebug( (ThisWindow.Object):GetListType(), 'ALL TYPE' ) |
|
После запуска примера эта команда показывает используемые типы элементов управления главного окна, как и ожидалось. Но еслм, напрмер, открыть и затем закрыть дочернее окно из пункта меню 'More Tests', то все эти элементы управления, которые показывала добавленная в меню команда, стираются из переменной ::oName В чем состоит моя ошибка и как это исправить
| |
|
|
SergKis
|
| постоянный участник
|
Пост N: 1580
Зарегистрирован: 17.02.12
|
|
Отправлено: 11.07.17 20:30. Заголовок: gfilatov2002 пишет В..
gfilatov2002 пишет цитата: | В чем состоит моя ошибка и как это исправить |
| тут моя ошибка, красным лишнее (убираться должно только в destroy() окна) CLASS TCnlData INHERIT TWndData ... // Destructor METHOD Destroy() INLINE ( ::Del(), ; ::oCargo := iif( HB_ISOBJECT(::oCargo ) , ::oCargo:Destroy() , Nil ), ; ::oEvent := iif( HB_ISOBJECT(::oEvent ) , ::oEvent:Destroy() , Nil ), ; ::oOnEventBlock := iif( HB_ISOBJECT(::oOnEventBlock ), ::oOnEventBlock:Destroy(), Nil ), ; ::oName := iif( HB_ISOBJECT(::oName ) , ::oName:Destroy() , Nil ), ; ::oHand := iif( HB_ISOBJECT(::oHand ) , ::oHand:Destroy() , Nil ), ; ::oUserKeys := iif( HB_ISOBJECT(::oUserKeys) , ::oUserKeys:Destroy() , Nil ), ; ::nParent := ::nIndex := ::cName := ::cType := ::cVar := ::cChr := Nil, ; hmg_DelWindowObject( ::nHandle ), ::nHandle := Nil )
| |
|
SergKis
|
| постоянный участник
|
Пост N: 1581
Зарегистрирован: 17.02.12
|
|
Отправлено: 11.07.17 20:35. Заголовок: PS Я сейчас в Питере..
PS Я сейчас в Питере и что бы что то смотреть, нужна Ваша сборка hmg, с собой у меня мало что есть.
| |
|
gfilatov2002
|
| moderator
|
Пост N: 1137
Зарегистрирован: 11.02.10
|
|
Отправлено: 11.07.17 21:10. Заголовок: SergKis пишет: убир..
SergKis пишет: цитата: | убираться должно только в destroy() окна |
| Благодарю за исправление! Сейчас после закрытия дочерних окон все в порядке Но если вызвать окно предварительного просмотра печати из главного окна, то после закрытия этого окна просмотра снова будет стерто содержимое переменной ::oName SergKis пишет: Завтра отправлю ссылку на Ваш почтовый адрес <bilance[at]bilance.lv>
| |
|
SergKis
|
| постоянный участник
|
Пост N: 1582
Зарегистрирован: 17.02.12
|
|
Отправлено: 11.07.17 21:34. Заголовок: gfilatov2002 пишет З..
gfilatov2002 пишет цитата: | Завтра отправлю ссылку на Ваш почтовый адрес <bilance[at]bilance.lv> |
| Лучше в личку, почты с собой нет, с работой общаюсь, через ftp
| |
|
gfilatov2002
|
| moderator
|
Пост N: 1138
Зарегистрирован: 11.02.10
|
|
Отправлено: 12.07.17 10:36. Заголовок: SergKis пишет: Лучш..
SergKis пишет: Отправил ссылку ы Л.С.
| |
|
SergKis
|
| постоянный участник
|
Пост N: 1583
Зарегистрирован: 17.02.12
|
|
Отправлено: 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 )) можно получать и на контролах
| |
|
gfilatov2002
|
| moderator
|
Пост N: 1139
Зарегистрирован: 11.02.10
|
|
Отправлено: 12.07.17 12:51. Заголовок: SergKis пишет: немн..
SergKis пишет: цитата: | немного подправить команду SET OOP <еще от переменной |
| Добавил новую команду SET OOP TO <lOOP> SergKis пишет: цитата: | еще предложение добавить функцию |
| Добавил, конечно. Благодарю за помощь
| |
|
SergKis
|
| постоянный участник
|
Пост N: 1586
Зарегистрирован: 17.02.12
|
|
Отправлено: 12.07.17 18:01. Заголовок: gfilatov2002 Думаю,..
gfilatov2002 Думаю, я был не прав с 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'
| |
|
Ответов - 300
, стр:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
All
[только новые]
|
|
|