The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Cannot launch custom Data Form from menu or toolbar
Posted: 21 Dec 06 9:56 AM
|
fiogf49gjkf0d Has anyone encountered this problem in v7.0?
If I create a custom Data form and make either a menu item or a button on toolbar to launch it, I get an error saying that form cannot be found. Any system forms will launch fine. Talked to developers from PSG group, and their only suggestion was to use Manage form instead of Data. Of course the disadvantagee is that I cannot specify BaseTable for Manage form and it takes much more code to save data from it. |
|
|
|
Re: Cannot launch custom Data Form from menu or toolbar
Posted: 21 Dec 06 10:23 AM
|
fiogf49gjkf0d This has always been the case. Never been able to call a data view directly from Menu/Toolbar.
I've not tried this myself but can't think of a reason why it wouldn't work. Instead of calling the form, create a script which has a ShowViewForRecord in it. Calling scripts isn't a problem and ShowViewForRecord doesn't cause problems so this workaround should do what you want. |
|
|
|
Re: Cannot launch custom Data Form from menu or toolbar
Posted: 21 Dec 06 10:24 AM
|
fiogf49gjkf0d You cannot launch a data form directly from a menu or toolbar. The reason is that a data form needs "context". That is, it needs to know how to bind everything. Since it does have a base table, it needs to know "for which record" it is loading (or for a new blank one). When a plugin is launched from a toolbar or menu, it is the same as launching it with Application.BasicFunctions.DoInvoke. You can't launch a data form with DoInvoke.
To launch a data form, you must use ShowViewForRecord instead (so you can pass to it the ID for the row to bind to on the base table, or a blank ID for a new record). So, what you'll need to do is have the toolbar button launch a script and the script launch the data form using ShowViewForRecord. Make sense?
To see more about ShowViewForRecord take a look here: http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=48 |
|
|
|
Re: Cannot launch custom Data Form from menu or toolbar
Posted: 21 Dec 06 11:13 AM
|
fiogf49gjkf0d Forgive me for being such a "Hard head", I'm a beginner
I have created a script with following code:
'C_HARDWARE- Table name, C_NEW_HARDWARE - Data form used to enter new hardware information into the table Function CallDataForm Application.BasicFunctions.ShowViewForRecord C_HARDWARE, C_NEW_HARDWARE End Function
I have assigned the script to the button on the toolbar, however when I click on the button, nothing happens. What am I doing wrong? |
|
|
|
Re: Cannot launch custom Data Form from menu or toolbar
Posted: 21 Dec 06 11:26 AM
|
fiogf49gjkf0d What is the name of the form plugin?
What family is it saved in?
What is the name of the table?
Are you wanting to launch the data form for a particular record, or to insert a new one?
Refer back to the article I mentioned to see the syntax for the ShowViewForRecord function. You are missing some parameters (it takes 4) and the parameters must be passed as strings. |
|
|
|
Re: Cannot launch custom Data Form from menu or toolbar
Posted: 21 Dec 06 1:46 PM
|
fiogf49gjkf0d Name of the plugin is: C_NEW_HARDWARE
Name of the script is: OpenDataForm
Table name is: C_HARDWARE
Saved in PERSONAL
I am trying to launch the Data form to insert a new record into the table
Function CallDataForm Application.BasicFunctions.ShowViewForRecord "C_HARDWARE", "PERSONAL:C_NEW_HARDWARE", "" End Function
The hint for ShowViewForRecord shows: Table name, View Name, ID I have tried with double quotes and without, still, no result at all.
The Action for a toolbar button set to "Active Script" and Argument is: Personal:OpenDataForm |
|
|
|
Re: Cannot launch custom Data Form from menu or toolbar
Posted: 21 Dec 06 1:59 PM
|
fiogf49gjkf0d When the script is invoked the Sub Main will be executed, not your CallDataForm function. Change the code to this:
Sub Main Application.BasicFunctions.ShowViewForRecord "C_HARDWARE", "PERSONAL:C_NEW_HARDWARE", "" End Sub |
|
|
| |
|