Normal Topic backup from command button (Read 1469 times)
addison1
Member
*
Offline


No personal text

Posts: 43
Joined: Aug 1st, 2004
backup from command button
Sep 3rd, 2004 at 3:13pm
Print Post Print Post  
I'm trying to run a backup from a command button.
I get to the backup item on the command tree by programming a couple of @selecttreeitems. Once "clicked" on the "backup application" item I'm presented with a choice of drives and files to select and accept. Having accepted the appropriate file and confimred overwrite, the backup runs and then returns to the main screen rather than my custom menu.
I can't figure a way to get back to the custom menu by programming at the command button which started the sequence.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: backup from command button
Reply #1 - Sep 3rd, 2004 at 5:05pm
Print Post Print Post  
How are you managing to leave the "custom menu" form in the first place? You can call @SelectTreeItem on menu options even if they are not on the currently displayed tree, so long as they are on an existing tab.

For example, in Customers.db - placing:
Code
Select All
var aa as int
aa = @SelectTreeItem("Sample Customers Application!Application Utilities!Backup Application")
 


in the On Element Entry event of the LE "City", will run from the customers add data form, even if the application menu is not currently visible (because it is on a different tab). Since the Application menu tree always exists, any form can select those items, without closing the form's tab or navigating off the form.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
addison1
Member
*
Offline


No personal text

Posts: 43
Joined: Aug 1st, 2004
Re: backup from command button
Reply #2 - Sep 3rd, 2004 at 6:45pm
Print Post Print Post  
The code is as you suggest,

var vback as int
If @add then
{vback=@selecttreeitem("Add Data Menu!Application Menu")
vback=@selecttreeitem("StAndrews!Application Utilities!Backup Application")
           
the problem is that after these statements execute, you choose the destination file, elect to overwrite, and then while the backup is being written you exit to the main screen. The tab with the custom menu is still available.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: backup from command button
Reply #3 - Sep 3rd, 2004 at 7:02pm
Print Post Print Post  
Code
Select All
 var vback as int
If @add then
{vback=@selecttreeitem("Add Data Menu!Application Menu")
vback=@selecttreeitem("StAndrews!Application Utilities!Backup Application")
 



In the code you posted your first @SelectTreeItem is moving the user off the current form. You do not need to do that. If you look at the example I posted, it selects a tree item from the application command tree without moving the user off of the form they are on. In other words, do this:

Code
Select All
var vback as int
If @add then
{
vback=@selecttreeitem("StAndrews!Application Utilities!Backup Application")
}
 


  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
addison1
Member
*
Offline


No personal text

Posts: 43
Joined: Aug 1st, 2004
Re: backup from command button
Reply #4 - Sep 3rd, 2004 at 7:35pm
Print Post Print Post  
Thanks, that works fine.
I was under the mistaked impreesion that the @selecttreeitems needed to operate sequentially.
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: backup from command button
Reply #5 - Sep 6th, 2004 at 7:05pm
Print Post Print Post  
You can automate the process completely if you incorporate a macro that types in the name of the backup file and then selects the "Accept" button.

If you want more details, let me know.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged