Work-around for a button in the data sheet


#1

Every now and again somebody laments the inability to add a procedure-activating button to the data sheet. I‘ve had this need on occasion and I’ve devised a simple work-around.

I create a procedure with the desired code in it and my .Initialize procedure places the minimised procedure window behind the data sheet like this:

33 am

I can then click on the Run button of the procedure as required. The procedure runs and the data sheet remains the active window. You could even have a string of procedures set up in this manner.


#2

Rather than doing that, why not just make a form with whatever buttons you need, and have the form window open next to the data sheet?

Also, don’t forget that you can easily create procedures with keyboard equivalents. If you don’t want to have to press the Command key, you can set up hotkeys. Panorama X doesn’t yet have a GUI for setting up hot keys, but it is pretty easy to write a short program to define them (quite a bit easier than it was in Panorama 6, I think, no need to look up special key code definitions).


#3

Two things that would make a lot of this possible in the Datasheet would be an EveryKey trigger and a CloseCell for the Field Properties Code.

Setting a field to UpperCase with Clairvoyance would allow an entry of y or Y or n or N then trigger a process to close the cell and, for instance, move DownRecord


#4

If we’re talking wish lists, put me down for a dashboard tool that was a pull-down menu that you could populate with your desired procedures.


#5

What is a “dashboard tool”? Do you mean a tool in the toolbar?

By the way, it is already possible to customize the menu that appears when you right click on the data sheet.


#6

No idea where that came from :frowning: Yes, I meant the toolbar.

We could have a race to see which method was faster. I still like mine.


#7

I saw potential in this for a scenario such as Kirby is pursuing, but I can’t get it to work. Even copying the example code gets no results. The menu changes accordingly, but ceases to do more than pop up. Same for the Column menu.

The .CustomMenu procedure never detects anything, and the standard selections do nothing. It can be reset and then the standard selections do work again.

This gets no results either as is or via .CustomMenu:
filemenubar “”,
menu(“Context Menu”)+
menuitem(“Select Same”)+
menuitem(“Select Different”)+
menuitem(“Select Contains…”),
“DATA_CONTEXTMENU”


#8

I’m running out the door right now so I can’t research this properly but I think you need to put code into each menu item.

I never use .CustomMenu any more, I always put the code into the menu items. But in this case, I believe there is no option, you must put the code into the menu itself. (And yes, the filemenubar documentation needs to be changed to reflect that.)


#9

You are correct. Once I added the code it does work. Apparently it’s true too if we simply try to add to the existing menu items. They no longer work unless they too have code added.