cancel
Showing results for 
Search instead for 
Did you mean: 

How to trigger a TCXButtonEdit OnButtonClick event

Highlighted
Contributor

How to trigger a TCXButtonEdit OnButtonClick event

 

Hi,

 

 

   I am having a problem trying to trigger the OnButtonClick event and the help/manual doesn't seem to help/work, and would like some feed back to see if its possible.

 

 Here's what I am hoping to accomplish.

 

  I have the above TCXButtonEdit on a UserForm.

  I have exported that form to a file *.aqfm

 

  I have a description.xml and a dialog.js file  that the description file is referencing as the script name.

  I have setup the KDTOperation so that my form comes up when I drag the keywork operation onto the keyword test script.

 

What I want to be able to do is, when the KDTOperation is drag into the test script, it shows the form, and on that form i want to click the button on the Text Editor field, (the button is part of tcxbuttonedit control), and opens up a OpenDialog. This allows me to select a file , and fill in the Text portion of the TCXButtonEdit with the filename.

 

Below is the desription.xml file - the OnButtonClick has been place inside the <Events> tag as well. This is the current code i have while testing for ways to make it work.

 

<ScriptExtensionGroup Name="EA">
    <Category Name="EA Extensions">
        <ScriptExtension Name="Common Dialog Controls" Author="" Version="" HomePage="">
            <Script Name="dialogs.js" InitRoutine="" FinalRoutine="">
		<RuntimeObject Name="Dialog Controls" Namespace="EA">
		    <Method Name="OpenFile" Routine="OpenFile" />
		    <Method Name="SaveAs" Routine="SaveAs" />
                    <Description>Dialog Controls</Description>
                </RuntimeObject>
		<KDTOperation Name="Open File" Category="Dialogs" ICON="" OperationType="Group">
		    <Data>
			<Field Name="FileName" DefaultValue="" />
			<Field Name="OpenOrSave" DefaultValue="Open" />
		    </Data>
                    <Events>
                        <Event Name="OnExecute" Routine="OpenFile_OnExecute" />
			<Event Name="OnSetup" Routine="OpenFile_OnSetup" />
			<Event Name="OnCreate" Routine="OpenFile_OnCreate" />
                    </Events>
                    <Columns>
                        <Column Name="Item" Value="Open a File"  />
			<Column Name="Operation" Value="Open dialog window to select a file" >
				<Event Name="OnButtonClick" Routine="OpenSaveFileDialog_OnClick" />
			</Column>
                    </Columns>
                </KDTOperation>
			</Script>
			<Description>Dialog Controls</Description>
        </ScriptExtension>
	</Category>
</ScriptExtensionGroup>

 

 

Here's the code for the above function of the OnButtonClick

 

function OpenSaveFileDialog_OnClick(Sender,AButtonIndex)
{
var frm=UserForms["DialogWindow"];
var OD=frm["OD"];
if(OD["Execute"]())
{
frm["txtFileName"]["Text"]=OD["FileName"];
return true;
}
return false;
}

function test()
{
if(UserForms["DialogWindow"]["ShowModal"]()!=mrOk || UserForms["DialogWindow"]["txtFileName"]["Text"]=="")
return false;

return true;
}

 

If i run the above test it works fine ( i had to assign the OnSaveFileDialog_OnClick function into the TCXButtonEdit's event for OnButtonClick. So I know there's no issue with the codes section.

 

But I cannot figure out yet how to run the OnSaveFileDialog_OnClick function when I am in the keyword testing design mode. 

 

Any help appreciated

1 REPLY 1
Highlighted
Contributor

Re: How to trigger a TCXButtonEdit OnButtonClick event

well.. ignore the above question... 

for some stupid reason.. now its working.. (not that i m complaining)..

 

 

New Here?
Join us and watch the welcome video:
Building with the Collaborator API

Help Documenation
The Collaborator API is a JSON-RPC API that lets you integrate with Collaborator 9.0 and above. For more information about how the API works, check out the API description here:


Sample Plugins
For an example of an add-in that uses the API, take a look at the Microsoft Word Add-in for Collaborator:


We list all the great plugins our network has already built on this page on the SmartBear website.

Labels