Dinkin Posted January 24, 2023 Share Posted January 24, 2023 Добрый день. В TUniMainModule в private у меня есть переменная id_user, могу ли я как то из TUniServerModule сделать перебор всех соединений с определенным id и запустить на них какую либо функцию из TUniMainModule ? Этим я хочу инициировать со стороны сервера событие у подключения. Quote Link to comment Share on other sites More sharing options...
Tokay Posted January 24, 2023 Share Posted January 24, 2023 Если я правильно понял вопрос, то лучше знать ID сессии и по нем искать: var Session := UniServerModule.GetSession(SessionID); var MainModule := TUniMainModule(Session.UniApplication.UniMainModule); 1 Quote Link to comment Share on other sites More sharing options...
Dinkin Posted January 25, 2023 Author Share Posted January 25, 2023 Спасибо! А могу лия таким образом обращаться с TUniMainModule одной сессии к другим TUniMainModule ? или всё-таки луче это делать через TUniServerModule ? Quote Link to comment Share on other sites More sharing options...
Tokay Posted January 25, 2023 Share Posted January 25, 2023 10 hours ago, Dinkin said: Спасибо! А могу лия таким образом обращаться с TUniMainModule одной сессии к другим TUniMainModule ? или всё-таки луче это делать через TUniServerModule ? Пробуй. Скорее всего будет работать. 1 Quote Link to comment Share on other sites More sharing options...
Dinkin Posted January 26, 2023 Author Share Posted January 26, 2023 Откуда не вызываю, функцию, возникает ошибка is refering a previous request,<br/>it's not allowed in AJAX request or JS handler.<br/>Use equivalent Public Property or Method instead Quote Link to comment Share on other sites More sharing options...
Dinkin Posted January 26, 2023 Author Share Posted January 26, 2023 В свою сессию отлично создается панелька на главной форме, а в чужие сессии ошибка. Может есть правило для работы с компонентами в чужих сессиях? Quote Link to comment Share on other sites More sharing options...
Dinkin Posted January 26, 2023 Author Share Posted January 26, 2023 На форме в Memo у меня ключи сессий, хочу в каждой сессии создать по кнопке void __fastcall TMainForm::UniButton1Click(TObject *Sender) { for(int i = 0; i < UniMemo1->Lines->Count; ++i) { TUniMainModule *modul = static_cast<TUniMainModule*>(UniServerModule()->GetSession(UniMemo1->Lines->Strings[i])->UniMainModule); TMainForm *MainForm = static_cast<TMainForm*>(modul->MainFormSender); TUniButton * button = new TUniButton(MainForm); button->Parent = MainForm; } } , но создается только в текущей, в других выходит ошибка Quote Link to comment Share on other sites More sharing options...
Dinkin Posted January 27, 2023 Author Share Posted January 27, 2023 up Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.