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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP Toolbar - How to remove already existing Separator? 2

Status
Not open for further replies.

Rajesh Karunakaran

Programmer
Sep 29, 2016
535
0
16
MU
Hi Team,

Hope you all keep find & safe!

I have a custom toolbar based on VFP toolbar in which I have command buttons and separators. Now, I am able to add another button to it by simply Copy/Paste of an existing button and I will modify the code and other properties, that is okay.

toolbar_lvxxld.png


However, I am not finding a way to remove the separator control, ie the 3 gaps you see in above pic.

Anyone has any idea?

Thanks in advance,
Rajesh
 
A separator is just an object, like any other. You can add and remove it just as you would a button or any other toolbar object.

The problem is that, because a separator is usually quite small, it can be difficult to select it - or even to see it. So do this:

1. In the Properties window, select the separator from the drop-down list at the top.

2. Click on the title bar of the class designer window (do not click on the toolbar itself, as this will change the selection).

3. Hit the Del key.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,

Happy to hear from you again dear!
Hope you, your family & every nears and dears are keeping fine and safe!
Take extreme care please!

Yes, that worked Mike, good idea! I am wondering why that didn't come to my mind!
Having said that, once it is selected that way, I am even able to move to another place. The only thing is you have to be very precise when and where you drop it. Thank you so much for your time.

Everyone take care please!
Rajesh
 
Hi,

You may even want do create your own toolbar "separator" (e.g. subclass command button - disabled - caption = "") at appropriate width during development and then resize it (e.g. width = 9) when running the application. This trick makes it easier for you to handle the "separators"



hth

marK
 
Hi marK,

that may be an idea for simpler handling, but such button separators will just not work as separators when you undock and resize a toolbar.

toolbarseparators_ctcoga.jpg

So that may only be applicable to toolbars you dock in an undock event? Ir never show users they could undock a toolbar?

But there is another hint in that, if you open a toolbar in the designer and resize it so the separated groups become rows, selecting the separator with the house becomes a little easier. It still just mainly one point, but it's always the point just off the left upper corner of the first button of a row. I still prefer selecting a separator object via the property window. It's a method of choice in many forms with pageframes anyway, to get to elements of a certain page.

Bye, Olaf.




Olaf Doschke Software Engineering
 
Hi Olaf,

that may be an idea for simpler handling, but such button separators will just not work as separators when you undock and resize a toolbar.

You're almost right - you may undock the toolbar and move it around but not resize it - my toolbar SIZABLE property is set to .F.

Thanks for the other hint

marK
 
OK, I see, restricting the sizability of an undocked toolbar can help. Most of the time I undock a toolbar is to dock it vertically, though.
I wonder if you would be better off using things like the ribbon of VFPX, but yes, I know, that's a big stretch and a total rework.

Bye, Olaf.

Olaf Doschke Software Engineering
 
At risk of overloading this thread, could I suggest another approach.

Instead of placing controls (buttons, separators, or anything else) directly in the toolbar, place a container in the toolbar, and place the controls inside the container. This will give you a lot more control over the placement of the individual controls. In means, for example, that you could place one button below another, which you can't normally do - and rely on it staying there even if the toolbar is undocked and resized.

I have a toolbar class in which the toolbar contains a container, and the container contains a pageframe. The individual pages of the pageframe contain the buttons or other controls that provide the actual functionality. The pageframe's tabs are hidden, and are replaced by a graphical option group. The whole thing slightly resembles the sort of ribbon you see in Microsoft Office.

Another thing I often do - even with a simple conventional toolbar - is to prevent the user from undocking it. Or at least to prevent undocking by default and to require them to explicitly override that in the user preferences. The reason is that, if the toolbar is undocked, it is too easy for the user to accidentally close it - often without realising they have done so - and to have no obvious way of getting it back.

These ideas won't be appropriate in all circumstances, but I have found them helpful in many different project.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top