x11 Posted October 9, 2020 Share Posted October 9, 2020 У мобильной формы, да и у обычной десктопной, есть стандартная встроенная кнопка закрытия окна. Как правильно в событии UnimFormClose показать окно с кнопками Да/Нет? Если пользователь ввел данные и случайно нажал на кнопку закрытия окна, как запросить у пользователя подтверждение? Link to comment Share on other sites More sharing options...
x11 Posted October 24, 2020 Author Share Posted October 24, 2020 up 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 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 Нет, спасибо. Это повлияет на работу всего приложения 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: Нет, спасибо. Ок. Остаётся тогда, проанализировать асинхронный код. 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 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; Было бы хорошо, если бы у форм были какие-то встроенные свойства. 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-функцией? Все правильно. Link to comment Share on other sites More sharing options...
x11 Posted October 28, 2020 Author Share Posted October 28, 2020 стандартная тема triton, стандартный диалог MessageDlg() - шрифт заголовка великоват или полоса заголовка слишком мала - некрасиво 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: Хмм. Link to comment Share on other sites More sharing options...
x11 Posted October 28, 2020 Author Share Posted October 28, 2020 что-то с customCSS, буду искать 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 к заголовку окна, по моему скромному мнению. Link to comment Share on other sites More sharing options...
Sherzod Posted October 28, 2020 Share Posted October 28, 2020 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" Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now