Dynamically add controls to sales order form via breakout.

Discussions relating to breakout scripting, .NET and COM programming with Jiwa objects.

Dynamically add controls to sales order form via breakout.

Postby Mike.Sheen » Fri Feb 12, 2010 8:36 pm

As of 06.05.12 HF#3, you can dynamically add controls to the sales order form.

This includes buttons, textboxes, even grids.

For more information, see here : http://www.jiwa.com.au:81/bugzilla/show_bug.cgi?id=6759
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Dynamically add controls to sales order form via breakou

Postby james.harper » Fri Mar 05, 2010 4:15 pm

That link appears to be broken... is there a problem with your servers or is the link incorrect?
james.harper
I'm new here
I'm new here
 
Posts: 5
Joined: Fri Mar 07, 2008 4:20 pm

Re: Dynamically add controls to sales order form via breakou

Postby james.harper » Fri Mar 05, 2010 4:21 pm

It turns out that the problem is on my end - something is blocking port 81 outbound.

Any chance you could publish it on a more normal port, eg maybe as bugzilla.jiwa.com.au or something?

thanks

James
james.harper
I'm new here
I'm new here
 
Posts: 5
Joined: Fri Mar 07, 2008 4:20 pm

Re: Dynamically add controls to sales order form via breakou

Postby Mike.Sheen » Mon Mar 08, 2010 8:27 pm

james.harper wrote:It turns out that the problem is on my end - something is blocking port 81 outbound.

Any chance you could publish it on a more normal port, eg maybe as bugzilla.jiwa.com.au or something?

thanks

James


I can post the text from the bug report right in here :
The sales order form can now have controls added dynamically via breakout
script, and the events associated with those controls can be handled using some
new breakout points.

The standard VB Form controls Command Button, Label, TextBox, CheckBox,
ComboBox and OptionButtton can be dynamically added by adding to a new control
array.

The additional control arrays provided in the form are :

CustomCommandButton
CustomTextBox
CustomCheckBox
CustomCombo
CustomLabel
CustomOptionButton

Helper functions have been exposed by the form to assist in adding controls to
these arrays :

AddNewCustomCommandButton
AddNewCustomTextBox
AddNewCustomCheckBox
AddNewCustomCombo
AddNewCustomLabel
AddNewCustomOptionButton

Other Active X Controls can also be added, by leveraging a new framework in
place for adding
controls using the VBControlExtender. A new collection - VBControls - allows
many VBControlExtenders to be added to the form.

Example usage : Add a tab to sales order form, and drop some controls on it - a
button, checkbox, combo, option button and a grid.

1. Run the following script to insert a permission for the Admin role to access
a tab with the key "Test" on the sales order form :

INSERT INTO HR_RolePermissions
SELECT '0835EBED-A299-4F79-82CC-FE5D53FB19FD',
(SELECT RolePermissionID FROM HR_RolePermissions WHERE ObjectID = '300' AND
RoleID = (SELECT RoleID FROM HR_Roles WHERE RoleName = 'Administrator')),
(SELECT RoleID FROM HR_Roles WHERE RoleName = 'Administrator'),
'Test', 'Tab', 2, '2008-11-04'


2. Add the following breakout scripts to the sales order breakouts :


' Form Loaded Breakout
' ====================
FormObject.SSMainTabs.Tabs.Add "Test", "Test"
Set TabPanel = FormObject.Controls.Add("ActiveTabs.SSTabPanel", "Test")
Set FormObject.SSMainTabs.Tabs("Test").TabPanel = TabPanel
FormObject.SSMainTabs.Tabs("Test").Visible = True

Set MyButton = FormObject.AddNewCustomCommandButton
MyButton.Caption = "test"
MyButton.Visible = True
MyButton.Left = 0
MyButton.Top = 0
MyButton.Top = 0
MyButton.ZOrder 0

FormObject.SSMainTabs.Tabs("Test").TabPanel.AddControl MyButton
MyButton.Visible = True ' The control is invisible by default.

Set MyTextBox = FormObject.AddNewCustomTextBox
MyTextBox.Text = ""
MyTextBox.Visible = True
MyTextBox.Left = 0
MyTextBox.Top = 0
MyTextBox.Top = MyButton.Top + MyButton.Height
MyTextBox.ZOrder 0

FormObject.SSMainTabs.Tabs("Test").TabPanel.AddControl MyTextBox
MyTextBox.Visible = True ' The control is invisible by default.

Set MyComboBox = FormObject.AddNewCustomCombo
MyComboBox.Text = ""
MyComboBox.Visible = True
MyComboBox.Left = 0
MyComboBox.Top = 0
MyComboBox.Top = MyTextBox.Top + MyTextBox.Height
MyComboBox.ZOrder 0

MyComboBox.AddItem "One"
MyComboBox.AddItem "Two"
MyComboBox.AddItem "Three"

FormObject.SSMainTabs.Tabs("Test").TabPanel.AddControl MyComboBox
MyComboBox.Visible = True ' The control is invisible by default.

Set MyCustomCheckBox = FormObject.AddNewCustomCheckBox
MyCustomCheckBox.Caption = "My CheckBox"
MyCustomCheckBox.Visible = True
MyCustomCheckBox.Left = 0
MyCustomCheckBox.Top = 0
MyCustomCheckBox.Top = MyComboBox.Top + MyComboBox.Height
MyCustomCheckBox.ZOrder 0

FormObject.SSMainTabs.Tabs("Test").TabPanel.AddControl MyCustomCheckBox
MyCustomCheckBox.Visible = True ' The control is invisible by default.

Set MyOptionButton = FormObject.AddNewCustomOptionButton
MyOptionButton.Caption = "Option 1"
MyOptionButton.Visible = True
MyOptionButton.Left = 0
MyOptionButton.Top = 0
MyOptionButton.Top = MyCustomCheckBox.Top + MyCustomCheckBox.Height
MyOptionButton.ZOrder 0

FormObject.SSMainTabs.Tabs("Test").TabPanel.AddControl MyOptionButton
MyOptionButton.Visible = True ' The control is invisible by default.

Set MyOptionButton = FormObject.AddNewCustomOptionButton
MyOptionButton.Caption = "Option 2"
MyOptionButton.Visible = True
MyOptionButton.Left = 0
MyOptionButton.Top = 0
MyOptionButton.Top = FormObject.CustomOptionButton(1).Top +
FormObject.CustomOptionButton(1).Height
MyOptionButton.ZOrder 0

FormObject.SSMainTabs.Tabs("Test").TabPanel.AddControl MyOptionButton
MyOptionButton.Visible = True ' The control is invisible by default.

' Add a grid, using the ProgID (FPSpreadADO.fpSpread.5 is actually the
progID for Spread 7)
Dim ControlExtenderControl
Set ControlExtenderControl =
FormObject.VBControls.Add("FPSpreadADO.fpSpread.5", "MyGrid", "")
FormObject.SSMainTabs.Tabs("Test").TabPanel.AddControl
ControlExtenderControl.VBControlExtenderObject

ControlExtenderControl.VBControlExtenderObject.Visible = True
ControlExtenderControl.VBControlExtenderObject.Zorder 0
ControlExtenderControl.VBControlExtenderObject.Top = MyOptionButton.top +
MyOptionButton.Height
ControlExtenderControl.VBControlExtenderObject.Left = 0

End Sub

' VB Control Object Event Breakout
' ================================
MsgBox FormObject.VBControls(Key).ControlName & " : " & EventInfo.Name
End Sub

' CustomCommandButton_Click Breakout
' ==================================

MsgBox "Button with caption : " & ControlObject.Caption & " Was clicked"
End Sub

' CustomTextBox_Change Breakout
' =============================
CustomTextBox_Change
End Sub

' CustomOptionButton_Click Breakout
' =================================
MsgBox ControlObject.Caption & " was selected"
End Sub

' CustomCombo_Click Breakout
' ==========================
MsgBox ControlObject.Text & " was selected"
End Sub


' CustomCombo_Change Breakout
' ===========================
MsgBox ControlObject.Text & " was changed"
End Sub


' CustomCheckBox_Click Breakout
' =============================
MsgBox "Checkbox value is : " & ControlObject.Value
End Sub

3. Close Jiwa and re-login (the permissions are cached at login time, so after
running the script in step 1, you would need to log back in).

4. Open the sales order form, note the presence of the "Test" tab - the
controls are shown on the form, and react when interacted with with message
boxes.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756


Return to Technical / Programming

Who is online

Users browsing this forum: Google [Bot] and 7 guests