[SOLVED!] Combined Refresh and Stop button? |
Post Reply |
Author | |||||
shipwreck
Senior Member Joined: 18 April 2008 Location: United States Status: Offline Points: 308 |
Post Options
Thanks(0)
Posted: 26 December 2009 at 11:23pm |
||||
Hello Folks!
Here is another question for you.
I was interested in creating one button in the commandbars to work as both the refresh and stop button. Similar to most other browsers available today.
So, I was wondering that if this is possible and if so, just exactly how to implement this.
If anyone can give me a suggestion or maybe a code example it would be greatly appreciated.
Thanks and Regards in advance.
|
|||||
Product: Xtreme Suite Pro (Active-X), Version 15.3.1
Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit) Language: Visual Basic 6.0 SP6 |
|||||
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
||||
Using Actions can help you here. First, in the General Declarations section, add some action IDs and a variable to store a reference to your Stop/Refresh button:
Note that these IDs should not be the same as IDs that you are using for other CommandBar controls. Next, before adding any CommandBar controls, make sure to enable actions and create your stop and refresh actions:
Next, add your Stop/Refresh button to the CommandBars (for this example, I am adding the control to a Ribbon), and then assign the starting action to it:
You can swap between actions as required by using this sub:
Finally, you can use the CommandBars_Execute event to test for (and perform) either action as follows:
Please note that some of this is air code, so if there are any problems, please get back to me. |
|||||
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|||||
shipwreck
Senior Member Joined: 18 April 2008 Location: United States Status: Offline Points: 308 |
Post Options
Thanks(0)
|
||||
Okay man I'm opening the virtual machine now & will get back to you on these. Thanks!
|
|||||
Product: Xtreme Suite Pro (Active-X), Version 15.3.1
Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit) Language: Visual Basic 6.0 SP6 |
|||||
shipwreck
Senior Member Joined: 18 April 2008 Location: United States Status: Offline Points: 308 |
Post Options
Thanks(0)
|
||||
Dude, your a life saver!
This functions wonderfully. But, I have another question.
I intend the commandbutton to have a refresh icon as well as a stop icon. is there anyway I can have those change in runtime as well?
|
|||||
Product: Xtreme Suite Pro (Active-X), Version 15.3.1
Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit) Language: Visual Basic 6.0 SP6 |
|||||
shipwreck
Senior Member Joined: 18 April 2008 Location: United States Status: Offline Points: 308 |
Post Options
Thanks(0)
|
||||
Okay man, I'll go ahead and create a new topic for the icon problem. Hite me up there. :]
|
|||||
Product: Xtreme Suite Pro (Active-X), Version 15.3.1
Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit) Language: Visual Basic 6.0 SP6 |
|||||
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
||||
Glad to help, but patience my friend, I'm in a different time zone ;)
The action objects that you create have an IconId property, so you can set the icons when you are creating the actions as follows: With Me.CommandBars1.Actions.Add(mc_ActionRefresh, "Refresh", "Refresh this page", "Refresh this page", "Page") |
|||||
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|||||
shipwreck
Senior Member Joined: 18 April 2008 Location: United States Status: Offline Points: 308 |
Post Options
Thanks(0)
|
||||
Oh, I see. That definitely makes sense. I'll try that asap!
But I figured the time zones were different. The whole website is setup that way. It's pretty funny actually, I can post a reply at 11:00 and it says I posted it at like 5:14 on the site.
|
|||||
Product: Xtreme Suite Pro (Active-X), Version 15.3.1
Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit) Language: Visual Basic 6.0 SP6 |
|||||
shipwreck
Senior Member Joined: 18 April 2008 Location: United States Status: Offline Points: 308 |
Post Options
Thanks(0)
|
||||
Okay jpbro. Just got finished trying that code. It works perfect!
But, and I apologize, but I have another question for you. :p
What if I wanted to do a three button combination?
For example, Go, Refresh, and Stop.
I think You would have the refresh and stop setup on active forms web browser control and you would then have it set that if the address in the address bar is different from the location URL it would be a go button, otherwise it would be the refresh button.
Is there any way in doing that?
|
|||||
Product: Xtreme Suite Pro (Active-X), Version 15.3.1
Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit) Language: Visual Basic 6.0 SP6 |
|||||
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
||||
Sure, just create a new Action object and assign it a unique ID...something like:
In the General Declarations: Private Const mc_ActionGo As Long = 102 And then, you will want to change the name of your control reference variable to make more sense: Private mo_StopGoRefresh As XtremeCommandBars.CommandBarControl Then wherever you create your actions, add: With Me.CommandBars1.Actions.Add(mc_ActionGo, "Go", "Go to this URL", "Go to this URL", "Page") And then instead of a SwapStopRefresh sub, you might want a SetPageState() sub (as an example): First in the General Declarations, create a new enum to indicate the page state:
And then add this sub, and call it with the appropriate page state parameter when your conditions are met:
|
|||||
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|||||
shipwreck
Senior Member Joined: 18 April 2008 Location: United States Status: Offline Points: 308 |
Post Options
Thanks(0)
|
||||
Okay jpbro, you've help me this far and I really appreciate it. So, let me ask you this:
I have been trying to implement a "Favorites/Bookmarks" bar into the browser, similar to firefox, chrome, safari, and even IE 8.
So far I haven't had any luck whatsoever on this one. I've tried several different ways using a text file, a database and etc.
In other words, I would like to have a toolbar that displays the users favorites and the user can edit, delete, and create more bookmarks to the bar at runtime.
Have any ideas on this one my friend?
|
|||||
Product: Xtreme Suite Pro (Active-X), Version 15.3.1
Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit) Language: Visual Basic 6.0 SP6 |
|||||
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
||||
What problems were you having? A database or a text file should be fine for storing bookmarks. You can Add CommandBar controls using the Add method of a CommandBar.Controls object, and then use the Delete method of any CommandBar.Controls.Item object.
Editing is a bit trickier - You could use the CommandBars1_ControlRButtonUp event to catch when a user right-clicks a control, and then test the Id property to see if the control is one of your Bookmark controls. If so, you could then use the ShowPopup method of a CommandBar object to offer a menu with Edit and Remove buttons. If the user clicks Edit (as caught in the _Execute event), just show a new window and allow them to change the displayed caption. |
|||||
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|||||
shipwreck
Senior Member Joined: 18 April 2008 Location: United States Status: Offline Points: 308 |
Post Options
Thanks(0)
|
||||
Okay, that pretty much describes exactly what I'm looking for jpbro. Is there anyway you could explain that option in further detail or maybe a sample?
|
|||||
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
||||
Unfortunately, I don't have much time right now to do up a sample as I have a project due very soon.
Between the RC sample and my explanation above, there should be enough to get started. Why don't you give it a try (maybe in a separate, new project) and when you encounter problems, you can post the project up here with questions (maybe a new thread would be better). I can then try to help with specific problems if I have a bit of time to spare (or others can help too). |
|||||
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|||||
shipwreck
Senior Member Joined: 18 April 2008 Location: United States Status: Offline Points: 308 |
Post Options
Thanks(0)
|
||||
Okay man but what are you leaning torwards when you say "RC Sample"?
|
|||||
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
||||
Sorry, I had the ReportControl on my mind from another post ;) I meant the CommandBars Ribbon Sample that ships with the CJ controls (in your Program Files\Codejock Software\ActiveX\Xtreme SuitePro ActiveX vX.X.X\Samples\CommandBars\VB\RibbonSample folder, where X.X.X is the version of the suite that you have installed).
|
|||||
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|||||
shipwreck
Senior Member Joined: 18 April 2008 Location: United States Status: Offline Points: 308 |
Post Options
Thanks(0)
|
||||
Oh, Okay. I see. Don't feel bad though, everyone makes mistakes ever once in a while.
But I'll attempt to try that I suppose. I'm not sure if I'll have any luck on this one since I'm not real familiar with the coding off the top of my head. But, I hope you get that project done! Best of luck! |
|||||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |