11/22/2024 10:51:44 PM
|
|
slxdeveloper.com Community Forums |
|
|
|
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!
Forum to discuss usage & tips for SalesLogix controls and other 3rd party ActiveX controls. View the code of conduct for posting guidelines.
|
|
|
|
Affect the Toolbar via Script
Posted: 30 Aug 06 9:45 AM
|
fiogf49gjkf0d Hi-
I have a need to visually inform a user of a toggle state they can affect. The best implementation of something like this would be to have a toolbar button that acts like a toggle switch. The user presses it and it stays depressed, press it again and it returns to 'normal'. Certainly this can be accomplished with replacing the bitmap of the button, but I know of no way to modify a toolbar button's bitmap on the fly/script.
The basic need is to give a user the ability to create a stopwatch type of punch-in/punch-out functionality for tracking time/create history records (not necessarily ticket activity records). Giving the user a visual cue that they are currently 'punched-in' would be optimal.
Thanks in advance for any insight into providing a visual toggle. -Adam
|
|
|
|
Re: Affect the Toolbar via Script
Posted: 30 Aug 06 5:16 PM
|
fiogf49gjkf0d Adam,
As far as I know, toolbar and menu bar attributes are not accessible at run time. Even if you could hack a solution by successfully manipulate the plugin’s blob data, I believe it would require a Crlt+F5 refresh to recache the plugin and display the update.
I think your best bet is to build something into the form where the event/update happens.
~JC
|
|
|
| |
|
Re: Affect the Toolbar via Script
Posted: 31 Aug 06 9:03 AM
|
fiogf49gjkf0d That sounds cool enough to try and implement! I had to hang up my C++ hat a while back, but always love to break it out now and again SalesLogix still has to obey the 'laws' of Windows, so this is a quite an elegant solution.
Have you tried your SLXEmbedButtonDemo sample code in v6.2.4 yet? Stepping through the code, FindWindowEx() fails to find "TwndMainView2". I can find "TmdiMain" and "TPanel" using Spy++. Has the main view parent window name changed to protect the guilty?
Thanks for your insight on this Ryan. -Adam
{edit} forward ahead 2 minutes... OK, after hitting the restore down button to place the account main view into non-maximized mode, Spy++ returned the name of the main window. It is now called "TfrmNewMainView". Changed it in the demo and bam.
Thank you so much for this Ryan! {/edit} |
|
|
|
Re: Affect the Toolbar via Script
Posted: 31 Aug 06 10:38 AM
|
fiogf49gjkf0d Hi Adam,
I was just coming to reply and noticed you already found that you already found what needed to change. I forgot the code sample had the old way. I guess I'll update the post.
-Ryan |
|
|
|
Re: Affect the Toolbar via Script
Posted: 27 Sep 06 1:20 PM
|
fiogf49gjkf0d you can dynamically change menus and toolbars at runtime in script.
the menu/toolbar needs to call a function, rather than a form/script, etc... in 6.2 you have to insert a function via SQL statement (secfunctions), in 7, you can do it via the "manage" menu in Architect.
Then, in a global script, you define 2 events for the function:
Function OnFunctionEnabled_ViewShowDevMenu(functionNumber, functionName) ' disable the item, but still visible 'Function OnFunctionVisible_ViewShowDevMenu(functionNumber, functionName) would make the menu/toolbar item not visible 'OnFunctionEnabled is very specific....and ViewShowDevMenu should be changed to match whatever you called your function in secfunctions 'put whatever code you want to select the status Dim objActiveView Dim blnResult
blnResult = False Set objActiveView = Nothing Set objActiveView = Application.MainViews.ActiveView If Not (objActiveView is Nothing) Then If Application.MainViews.ActiveView.BaseTable = "OPPORTUNITY" Then blnResult = True End If End If OnFunctionEnabled_ViewShowDevMenu = blnResult End Function
Function OnBeforeFunctionExecute_ViewShowDevMenu(functionNumber, functionName) 'OnBeforeFunctionExecute is specific, ViewShowDevMenu should change to match your function in secfunctions Application.BasicFunctions.DoInvoke "Form", "Personal:pluginnamegoeshere" ' launch your form/script, etc OnBeforeFunctionExecute_ViewShowDevMenu = True ' tell SLX that the event has been handled so it doesn't keep trying to handle the event End Function
you can see another example of this in the opportunity statistics global script
easy to implemenent if you don't mind having 2 buttons (that toggle each other)...just set a global variable and enable/disable the buttons based on the value
more difficult if you want to toggle the image on a single button....i think the image is stored in the blob field in the plugins table. so you would have to write a new value to the blob each time....
|
|
|
|
Re: Affect the Toolbar via Script
Posted: 27 Sep 06 4:29 PM
|
fiogf49gjkf0d you can add 2 toolbar buttons and use the OnFunctionVisible_ event. set visible based on the value of a global variable. The OnBeforeFunctionExecute_ event executes whatever you need and also toggles the value of the global variable to the user, it looks like the image on the button is changing....
|
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|