Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Display modal form on startup
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00669077
Message ID:
00670010
Vues:
40
If you insist that the login form must be modal, it can't be a top-level form. If you're willing to give up the top-level form, then you can create the login as a modal form. Only a modal form can return a value to what called it. Here is an example of what I do (you may want to use an application object instead of public variables):
* Main.prg
public g_ConfigId, g_Privileges, g_User

local OldTalk, OldStatus, OldCentury, OldError, OldDelete, OldMultiLocks, OldBell
local OldSafety, OldStatusbar, OldNotify

set sysmenu off
OldTalk = set('Talk')
set talk off
OldStatus = set('Status')
OldCentury = set('Century')
OldError = on('Error')
OldDelete = set('Deleted')
OldMultilocks = set('Multilocks')
OldBell = set('Bell')
OldSafety = set('Safety')
OldStatusbar = set('Status bar')
OldNotify = set('Notify')
on shutdown quit

_screen.windowstate = 2
_screen.caption = 'Your App Title'
_screen.visible = .T.
_screen.icon = 'AppIcon.ico'
if getenv('VFPTEST') = '.T.'
   set resource on
else
   set resource off
endif

clear
close databases all
close all
hide window all           && will hide the project manager if it's open
if wexist('Standard')
   hide window Standard      && hide standard toolbar if it's open
endif
if wexist('Form Controls')   && hide form controls toolbar if it's open
   hide window Form
endif

set path to C:\VFPData; data; source
do SetSets
do FileChk

set classlib to PCsSpecial

do form Splash    && This form is not top-level and is not modal
do form Login to g_ConfigId    && This form is modal
g_Privileges = GetPrivs(g_ConfigId)
g_User = GetUser(g_ConfigId)
set sysmenu on
set sysmenu automatic
do main.mpr
if getenv('VFPTEST') = '.T.'
   do cancel.mpr
endif
read events

set status &OldStatus
set talk &OldTalk
set century &OldCentury
on error &OldError
set deleted &OldDelete
set multilocks &OldMultilocks
set bell &OldBell
set safety &OldSafety
set sysmenu to default
set status bar on
set notify on
on error

return
*------------------------------------------------------------------------------
>Hi,
>Thank you for reply.
>I have try your suggestion, but it seem not working, and I am not very sure how to do so. Can you please send me a sample, which
>
>1. A form modal that act as login form, will be run on main.prg.
>2. The login form will return value to main.prg for validation.
>3. At this moment, my login form is hide itself when user click on OK or cancel button. Then main.prg will get it's return value from loginform.property, and release. IF you have other way, please use it.
>4. If login successfully, frmMAin will be called.
>
>Please note that, I may call this login form to let user login for switch user and inherit it to be only supervisor login form. (It is ok if you don't have time to consider this)
>
>
>Thank you
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform