Advertisement
dooly386

FormClose

May 7th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1. void __fastcall TSystemColorTableForm::FormCloseQuery(TObject *Sender, bool &CanClose)
  2.  
  3. {
  4.     CanClose = true;
  5.  
  6.     if(m_form)
  7.     {
  8.         c_form *m_frame = (c_form *)m_form;
  9.         c_lua &lua = m_frame->GetLua();
  10.         if(lua.IsFunction("on_close_query"))
  11.         {
  12.             CanClose = lua.callT<bool>("on_close_query",(lua_Integer)Sender);
  13.         }
  14.     }
  15. }
  16.  
  17.  
  18.  
  19.  
  20. void __fastcall TSystemColorTableForm::FormClose(TObject *Sender, TCloseAction &Action)
  21.  
  22. {
  23.     //TCloseAction : unsigned char { caNone, caHide, caFree, caMinimize };
  24.     Action = caFree;
  25.     if(m_form)
  26.     {
  27.  
  28.         c_form *m_frame = (c_form *)m_form;
  29.         c_lua &lua = m_frame->GetLua();
  30.         if(lua.IsFunction("on_close"))
  31.         {
  32.             Action = (TCloseAction)lua.callT<lua_Integer>("on_close",(lua_Integer)Sender);
  33.         }
  34.     }
  35. }
  36.  
  37.  
  38. FormConstructor
  39.  
  40.     RUNMODULE("utils/module_form","RestoreDialogFormStorage",m_form.Object())
  41.     RUNMODULE("utils/module_form","RestoreStatusKeeper",m_form.Object())
  42.  
  43.  
  44.  
  45. function on_close(Sender)
  46.     --TCloseAction : unsigned char { caNone, caHide, caFree, caMinimize };
  47.     --on_close = nil
  48.     RUNMODULE("utils/module_form","StoreStatusKeeper",m_form.Object())
  49.     return 2
  50. end
  51.  
  52. function on_close_query(Sender)
  53.     return true
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement