Author Topic: ASK : Script Code Pada Menu QUIT Aplikasi  (Read 126 times)

0 Members and 1 Guest are viewing this topic.

Offline honghong

  • Full Member
  • *
  • Posts: 53
    • mitrahosting.com
ASK : Script Code Pada Menu QUIT Aplikasi
« on: November 01, 2018, 04:59:24 PM »
Para mastah sekalian,

barangkali ada yang menggunakan menu bar pada _SCREEN (menggantikan menubar Visual FoxPro) di aplikasinya, bolehkah saya dibagikan script code untuk menu QUIT tersebut ?
Saya inginnya supaya ketika menu QUIT kita klik, maka aplikasi akan menutup namun tidak ikut menutup program Visual Foxpro (karena saya masih ingin bekerja / masih mendevelop aplikasi dan tidak ingin menjalankan program Visual Foxpro berulang kali dari awal)

Terima kasih banyak sebelumnya  :dontknow:
--= mitrahosting.com =--
the quality web hosting provider for the quality partners

Offline xWongso

  • Newbie
  • *
  • Posts: 25
Re: ASK : Script Code Pada Menu QUIT Aplikasi
« Reply #1 on: November 02, 2018, 09:59:33 AM »
Coba Pak Honghong setting di Menu Utama...

Code: [Select]
****bla...bla...bla...

Do SetupScreen

Do Form YourForm.scx ---------------> Call your 2-As Top Level FORM

On Shutdown Clear Events
Read Events
Do ProperShutdown

********************
Procedure SetupScreen
********************
If _vfp.StartMode = 0
_Screen.Tag = _Screen.Caption
Endif
_Screen.Visible=.F.
Endproc

********************
Procedure ProperShutdown
********************
Local loForm

On Shutdown
Clear Events
Release All

If _vfp.StartMode = 0
Set Sysmenu To Default
On Error
Endif

loForm = .Null.
For Each loForm In _Screen.Forms
loForm.Release()
Next

On Key 
Close Databases All
Clear All
If _vfp.StartMode = 0
_Screen.Caption = _Screen.Tag
_Screen.Tag = ""
_Screen.Visible = .T.
Cancel
Else
Quit
Endif
Endproc

Rgds
XWongso

Offline honghong

  • Full Member
  • *
  • Posts: 53
    • mitrahosting.com
Re: ASK : Script Code Pada Menu QUIT Aplikasi
« Reply #2 on: November 02, 2018, 11:18:36 AM »
Coba Pak Honghong setting di Menu Utama...

Code: [Select]
****bla...bla...bla...

Do SetupScreen

Do Form YourForm.scx ---------------> Call your 2-As Top Level FORM

On Shutdown Clear Events
Read Events
Do ProperShutdown

********************
Procedure SetupScreen
********************
If _vfp.StartMode = 0
_Screen.Tag = _Screen.Caption
Endif
_Screen.Visible=.F.
Endproc

********************
Procedure ProperShutdown
********************
Local loForm

On Shutdown
Clear Events
Release All

If _vfp.StartMode = 0
Set Sysmenu To Default
On Error
Endif

loForm = .Null.
For Each loForm In _Screen.Forms
loForm.Release()
Next

On Key 
Close Databases All
Clear All
If _vfp.StartMode = 0
_Screen.Caption = _Screen.Tag
_Screen.Tag = ""
_Screen.Visible = .T.
Cancel
Else
Quit
Endif
Endproc

Rgds
XWongso

Terima kasih codenya pak Wongso, sangat membantu sekali. Tinggal copy paste keseluruhan, sudah bisa berjalan mulus...  :icon_salut:
« Last Edit: November 02, 2018, 12:35:22 PM by honghong »
--= mitrahosting.com =--
the quality web hosting provider for the quality partners