![]() |
#13 |
Участник
|
Цитата:
Содаем на форме метод X++: // --> get last active formDataSource int getControlDataSourceId( FormControl _formControl = element.selectedControl() ) { Object object = _formControl ; SysDictClass sysDictClass ; int dataSourceId ; ; if( !_formControl ) return 0 ; sysDictClass = new SysDictClass( classidget( object ) ) ; if( !sysDictClass.hasObjectMethod( identifierstr( DataSource ) ) ) return 0 ; dataSourceId = object.dataSource() ; return dataSourceId ; } // <-- get last active formDataSource X++: public class FormRun extends ObjectRun { ... // --> get last active formDataSource int lastDataSourceId ; // <-- get last active formDataSource } X++: public boolean selectControl(FormControl _control) { boolean ret ; // --> get last active formDataSource int dataSourceId = element.getControlDataSourceId( element.selectedControl() ) ; if( dataSourceId ) lastDataSourceId = dataSourceId ; // <-- get last active formDataSource ret = super(_control); return ret; } X++: void clicked() { ... // --> get last active formDataSource switch( lastDataSourceId ) { case <Table1>_ds.id() : // TODO: код для источника данных <Table1>_ds // info( <Table1>_ds.name() ) ; break ; case <Table2>_ds.id() : // TODO: код для источника данных <Table2>_ds // info( <Table2>_ds.name() ) ; break ; case <Table3>_ds.id() : // info( <Table3>_ds.name() ) ; break ; default: break ; } // <-- get last active formDataSource } |
|
|
За это сообщение автора поблагодарили: Poleax (1), Sergey Petrov (1). |