Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a toolbar with custom buttons which can run a PRG file with a click

Status
Not open for further replies.

dkean4

Programmer
Feb 15, 2015
282
0
0
US
I need to add a custom toolbar with customized buttons/icons to do something of my choosing, like run a PRG file when a button is clicked. I would like to add that toolbar to all the default toolbars in the VFP screen as to enrich my DEV environment as I develop.

This would help so I do not need to type on the Command bar Do this_Silly_file.prg or Do this_And_That.prg.

Can a custom function be added to a custom button in a custom toolbar?


Dennis Kean

TIA





Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
It seems you haven't installed Thor.

Thor Home said:
What's New

Thor 1.40 – Released 2013-08-26
Added the Thor ToolBar. Tools may be added to the Toolbar may using the checkbox shown in the Thor Configuration form, below (and also available in the Tool Launcher.)

The Thor Toolbar starts with one Tool: Edit Thor. This will get you to the Thor Configuration.
Thor_a9mcxq.png

Here you can change the toolbar by assigning tools to the thor toolbar from all available tools and also create your own tools.

Bye, Olaf.
 
Agree 100% with Olaf. Use Thor for this and save yourself the trouble.

Tamar
 
Hi,

You could also try to do the following:

1) create a startup.prg to extend your default menu:
** Here I have extended my Tools menu with an option to activate hexedit.scx just as an example, you can replace this with any
** other form or command to your liking.

Code:
Define Bar 998 Of _mtools Prompt 'Hexedit'

On Selection Bar 998 Of _mtools Do Form Home()+"tools\hexedit\hexedit"
2)save this little prg somewhere on your HD.
3)assign "startup.prg" to your startup program:
in VFP menu Tools -> Options -> File Locations now look for Startup Program and set the fullpath.
4) restart VFP

2 lines of code and you are done.
And you can extend your tools menu with as many more bars, just add a new one 997 a.s.o.
Regards,
Jockey
 
Yes, and VFPs own Toolbars dialog (View->Toolbars) also has New/Customize buttons. In the customization you can only pick from native categories and their tools, though.
In the end it is easier to define menu items, yes. If you assign a hotkey to them you can also define very simple toolbar buttons just doing a KEYPRESS of the defined hotkey...

The big advantage of the Thor toolbar is, that you a) define your tools in a way asking you some meta data, thereby b) become part of that platform and c) could even think of providing that tool as an official Thor add on. Why not join that infrastructure instead of puzzling your own. Well, I know there is a lot you might already have and only part of it would be valid to publicly share, either because of copyrights or because of being a tool very specific to you and of low public interest. But even that can be put into the Thor tools, your own tool categories will not be overwritten by updates and by creating tools you also don't automatically publish them.

Bye, Olaf.

PS: nice edit of your post, Dennis, I think you found it yourself already. Is it leaving you speechless? ;)
 
I just installed Thor on a PC to test it, Olaf. I don't know what you meant by "nice edit of your post". I have been posting that way for a while.

How safe is this app and how sure can I be that this software will not publish all my work somewhere I don't want it to go?

Is the original code of this app available, so I can see what is going on? After I installed Thor, Wireshark is suddenly detecting download and upload packets. I understand download in part, but what did it upload from my PC? I mean there were no confirmation screens and I found an outgoing packet with lines of one of my PRG files. What is that about?

After much testing, I have lost my confidence in Thor. I prefer Jockey4's idea. I will use Thor on a test PC, for trivial apps, but not on my production network.

Thank you guys, anyway... It looks interesting and someone did a good job, I just can't take risks with my clients.


Dennis





Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
Nice edit: Well, I meant your now empty post from 2 Mar 17 00:18.

Thor is open source, most all components in VFPX are, despite some binaries of the original Sedna contribution from MS which started it and maybe something else I'm not aware off, but in general codeplex is a site for open source projects, just like github or sourceforge.

Yes, Thor begins with updating itself, and for that matter makes web requests, which wireshark of course also detects. I don't see it uploading my own tools, but whatever, you'll know better than me.

OK, then go your own route.

Bye, Olaf.

 
It would be a pity to discard Thor, which has a lot of very useful features. But my own preference would be to go for Jockey's solution, if only because it is so simple to implement.

I have done something very simlar in my own development environment, except that rather than add bars to the existing Tools menu, I have a completely new Dev Tools menu.

For what its worth, here is my code:

Code:
DEFINE PAD _1w013e7hw OF _MSYSMENU PROMPT "\<DevTools" COLOR SCHEME 3 ;
	AFTER _MTOOLS ;
	KEY ALT+D, ""
ON PAD _1w013e7hw OF _MSYSMENU ACTIVATE POPUP devtools

DEFINE POPUP devtools MARGIN RELATIVE SHADOW COLOR SCHEME 4
DEFINE BAR 1 OF devtools PROMPT "\<Parse Locals ..."
DEFINE BAR 2 OF devtools PROMPT "\<HackCX ..."
DEFINE BAR 3 OF devtools PROMPT "Activate Property \<Inspector"
DEFINE BAR 4 OF devtools PROMPT "\<Data Explorer"
DEFINE BAR 5 OF devtools PROMPT "Important \<Notes ..."
ON SELECTION BAR 1 OF devtools do c:\fox\tools\parselocals
ON SELECTION BAR 2 OF devtools do c:\fox\tools\hackcx4.exe
ON SELECTION BAR 3 OF devtools do c:\fox\tools\inspector
ON SELECTION BAR 4 OF devtools do (home(1) + "DataExplorer.APP")
ON SELECTION BAR 5 OF devtools modify file c:\fox\tools\ImportantNotes.txt

As you can see, I populated the Dev Tools menu with the following items:
[ul]
[li]ParseLocals (sorry, can't remember who wrote it)[/li]
[li]Rick Schummer's ever-useful HackCX[/li]
[li]My home-grown run-time property inspector[/li]
[li]The built-in Data Explorer module (haven't used that for a long time)[/li]
[li]A text file containing important notes and to-do items that I can edit on the fly.[/li]
[/ul]

But obviously you can choose whatever tools you like.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thor is really nice and I will gladly use it with VFP Development which is not essential to my clientele. For that, thanks, Olaf. You always come up with great solutions. I appreciate your suggestions always. My reply may have come off on a wrong note... My apology.





Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
Dennis,
I am fully with you. Thor is a fantastic tool but not at all usefull, essential for your clients. Please keep it in your own environment only.
Meanwhile enjoy it, and I would advise to disable the autoupdate, its good enough to update once and lately only once a week. This will save you some valuable startup time and will also save you from Gig's of newcreated files. On every new update an other about 1GG is added to your HD.
Regards,
Jockey4
 
The topic is about own usage only. Thor is an IDE extension managing all VFPX IDE enhancements, it is not a tool to integrate into your applications, of course not. Nobody said so.

Bye, Olaf.
 
Dennis said:
You always come up with great solutions
Well, inn this case just pointing to great solutions put together from all the VFP community. VFPX is a roof well known to all still doing VFP applications support, so slightly surprised you don't know Thor, as it has become a central part of VFPX to provide all this combined open sourced VFP knowledge. Especiall Thor tools already existing are quite an array of well known single enhancements bringing together classic and new extensions to the IDE.

Dennis said:
My reply may have come off on a wrong note... My apology
It came over a bit wrong, not so much of a problem, though. I now cope more with what you accuse Thor of. You often surprise me with a mix of looking in detail and at the same time failing to see the woods for the trees. The download of Thor contains all its source code, so you might investigate how it acts on your tools you put in the MyTools subfolder.
Have you kept your Wireshark capture to show to the Thor developers. I'm sure they'd be happy to fix that, because their only intention to upload tools is for those tools you put into the thor repository and not in your "My tools" section. And surely not to start with when updating itself, it has none of your own tools yet. What kind of accusation is that?

Bye, Olaf.
 
Mike,

Thanks for the suggestion with your code. I have implemented it as well. I also created a Shortcut Menu and bound it to the _SCREEN.RightClick event. This way I can have a long list and I do not have to aim at a specific location to drop a menu list. It seems to be the fastest way to access a pick-list of commands. And I wired it into the Project so that it comes up customized for each project. I should have thought of that earlier. I'm getting old and silly.



Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
I have spent a lot of time trying to retrigger the outgoing packets of Thor in WireShark. No can do. So, I don't know what to think, now. I cannot explain what happened.

As regards Thor's source I found it. Thanks. Sorry, my mind is so focused on a current project that I do not lend external distractions enough attention. So I accept your criticism. I will try to lend more attention where it is due. However, I am fighting many battles in many scripts, languages, lately. So I ask for your patience.

Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
I'm okay with that, Dennis. It was just such an accusation should have a basis. I do believe you saw something, it would have been a good move to save that capture log at that time and then come back later to it, if time allows.

You may later reproduce by removeing Thor and reinstalling it, or when first installing on another PC. The whole initial update procedure is a one time action, that - I think - only repeats, if you choose to check for updates. I just don't see a reason that feature will be uploading anything than perhaps the version number of the installation to determine necessry update downloads.

If that capture was done after you added own tools, it should be easier to reproduce.

Anyway, it's also fine to have a simpler mechanism of a single feature you can even have per project. Thor surely is more focused on tools of general usefulness.

Bye, Olaf.

 
@Jockey4 -- you can tell Thor how often to look for updates. I have it set to look once a week. Just pass 7 (or however many days you want) as a parameter to the call in your startup program.

Tamar
 
Thanks Olaf...

Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top