Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, November 22, 2024 
 
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!
 Architect Forums - Controls
Forum to discuss usage & tips for SalesLogix controls and other 3rd party ActiveX controls. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Controls | New ThreadView:  Search:  
 Author  Thread: Affect the Toolbar via Script
Adam Rudolph
Posts: 2
 
Affect the Toolbar via ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
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
[Reply][Quote]
Jeff Crawford
Posts: 52
 
Re: Affect the Toolbar via ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
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
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Affect the Toolbar via ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Aug 06 10:35 PM
fiogf49gjkf0d
You can't get to the toobar items at runtime. A bummer, I know. However, you could embed some outside object in the toolbar (this would be an unsupported customization, don't expect to get help from sage tech support or anything doing this sort of thing).

I posted about this quite some time ago here: http://saleslogixblog.com/rfarley/archive/2004/04/06/508.aspx

-Ryan
[Reply][Quote]
Adam Rudolph
Posts: 2
 
Re: Affect the Toolbar via ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
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}
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Affect the Toolbar via ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
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
[Reply][Quote]
John Crumpton
Posts: 26
 
Re: Affect the Toolbar via ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
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....
[Reply][Quote]
John Crumpton
Posts: 26
 
Re: Affect the Toolbar via ScriptYour last visit to this thread was on 1/1/1970 12:00:00 AM
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....
[Reply][Quote]
 Page 1 of 1 
  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!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/22/2024 7:48:14 PM