Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can execute a button click method without showing the fo
Message
 
 
À
23/09/2019 15:37:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01671046
Message ID:
01671080
Vues:
67
It will take me 10 years to refactor all places where I have code in the event method (e.g. cmdSave.click()) :)

>Yes, it works, but now you see one of the disadvantages of this approach. Read more here: http://fox.wikis.com/wc.dll?Wiki~EventsShouldAlwaysCallMethods
>
>>As far as "you shouldn't have ..." I don't know. This approach has been working for about 20 years. Maybe it is not the best practice, I admit. But it worked.
>>Getting back to what you and Naomi are saying, if I move the code to a method, would I be able to run this code without showing the form?
>>
>>>You shouldn't have any code in a click() event, other than a call to a method, for instance a form method or a button method. That's why my base button class has an onclick() event which by default is called from click().
>>>
>>>>Hi,
>>>>
>>>>I have a procedure that runs in a button click method. Here is the summary of the involved forms/windows:
>>>>1. Window/Form1 - User selects certain time period and click on Execute button
>>>>2. In the Form1 Execute button click code instantiates creates another form (Form2). Certain parameters are set in the form Form2. Then the Form2 method Show is called. E.g. Form2.Show()
>>>>3. The Form2 has the Process button with the click code that is the main code that has to be executed. In the Activate method of the Form2 the click method of the Process button is called. The code in the Activate method is as follows:
>>>>
>>>>thisform.cmdProcess.click()
>>>>
>>>>
>>>>The form Form2 is shown during the entire process executed in the cmdProcess button.
>>>>
>>>>I need to run the code in the cmdProcess.click() from another program that will run from the Windows Scheduler - without any user interface.
>>>>
>>>>Can I execute the code without Show() of the Form2? That is, can the code
>>>>
>>>>thisform.cmdProcess.click()
>>>>
>>>>run without the form on which the button reside being shown? That is, without steps 1 and 2 above. Just Step 3 without opening the form?
>>>>
>>>>TIA
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform