x11 Posted October 9, 2020 Share Posted October 9, 2020 У мобильной формы, да и у обычной десктопной, есть стандартная встроенная кнопка закрытия окна. Как правильно в событии UnimFormClose показать окно с кнопками Да/Нет? Если пользователь ввел данные и случайно нажал на кнопку закрытия окна, как запросить у пользователя подтверждение? Quote Link to comment Share on other sites More sharing options...
x11 Posted October 24, 2020 Author Share Posted October 24, 2020 up Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 27, 2020 Share Posted October 27, 2020 On 10/9/2020 at 6:05 PM, x11 said: Как правильно в событии UnimFormClose показать окно с кнопками Да/Нет? UniMainModule.EnableSynchronousOperation = True - это один из способов: procedure TMainmForm.UnimFormClose(Sender: TObject; var Action: TCloseAction); begin if MessageDlg('Вы действительно хотите закрыть окно?', mtConfirmation, [mbYes, mbNo]) <> mrYes then Action := caNone end; http://unigui.com/doc/online_help/synch-and-asynch-operations.htm Quote Link to comment Share on other sites More sharing options...
x11 Posted October 27, 2020 Author Share Posted October 27, 2020 1 hour ago, Sherzod said: EnableSynchronousOperation Нет, спасибо. Это повлияет на работу всего приложения Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 27, 2020 Share Posted October 27, 2020 11 minutes ago, x11 said: Нет, спасибо. Ок. Остаётся тогда, проанализировать асинхронный код. Quote Link to comment Share on other sites More sharing options...
x11 Posted October 27, 2020 Author Share Posted October 27, 2020 В uniMainModule есть свойство BackButtonAction. Т.е. когда нажимаешь кнопку Назад в браузере, то появляется подтверждающий диалог, где можно нажать Отмена. Это я к тому, что у uniGui какой-то механизм диалогов подтверждения есть? Может быть можно придумать что-то с callback-функцией? 1 Quote Link to comment Share on other sites More sharing options...
x11 Posted October 27, 2020 Author Share Posted October 27, 2020 Вроде бы получилось ... private bAllowClose: boolean; // по умолчанию False ... ... procedure TfmmParentObject.UnimFormClose(Sender: TObject; var Action: TCloseAction); begin if bAllowClose then begin Action := caFree;// когда вызвали закрытие через CloseCallbackAnonProc exit; end else Action := caNone;// ничего не делать MessageDlg('Закрыть окно', mtWarning, mbYesNo, CloseCallbackAnonProc); end; procedure TfmmParentObject.CloseCallbackAnonProc(Sender: TComponent; Res: Integer); begin if Res = mrYes then begin bAllowClose := True; close;// снова вызываем закрытие окна end; end; Было бы хорошо, если бы у форм были какие-то встроенные свойства. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 27, 2020 Share Posted October 27, 2020 45 minutes ago, x11 said: Может быть можно придумать что-то с callback-функцией? Все правильно. Quote Link to comment Share on other sites More sharing options...
x11 Posted October 28, 2020 Author Share Posted October 28, 2020 стандартная тема triton, стандартный диалог MessageDlg() - шрифт заголовка великоват или полоса заголовка слишком мала - некрасиво Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 28, 2020 Share Posted October 28, 2020 23 minutes ago, x11 said: Хмм. Quote Link to comment Share on other sites More sharing options...
x11 Posted October 28, 2020 Author Share Posted October 28, 2020 что-то с customCSS, буду искать Quote Link to comment Share on other sites More sharing options...
x11 Posted October 28, 2020 Author Share Posted October 28, 2020 Нашел. Это я уменьшал заголовки unimPanel. Получается, что в uniGUI заголовок unimPanel связан с заголовком диалоговых окон. Вы считаете, что так правильно? Совершенно разные ведь компоненты. Как-то нелогично применять x-panelheader к заголовку окна, по моему скромному мнению. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 28, 2020 Share Posted October 28, 2020 Quote Link to comment Share on other sites More sharing options...
x11 Posted October 28, 2020 Author Share Posted October 28, 2020 хм... и зачем они так сделали? ну ок. В общем, исправил у себя /*высота заголовка панелей*/ .x-big .x-panelheader.x-horizontal.x-noborder-trl { min-height: 10px; height: 20px; } добавил ".x-noborder-trl" 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.