ToolBarImageButton() and optional Text$ a no go

You need some new stunning features ? Tell us here.
Jimbob81
User
User
Posts: 18
Joined: Thu Jun 25, 2020 7:17 am

ToolBarImageButton() and optional Text$ a no go

Post by Jimbob81 »

Hello,

In the Form Designer when creating a ToolBar with image there appears to be no properties option to enter the optional text to display with ToolBarImageButton()

From the help file
ToolBarImageButton()

Syntax
ToolBarImageButton(#Button, ImageID [, Mode [, Text$]])

Description
Add an image button to the toolbar being constructed. CreateToolBar() must be called before to use this function.

Parameters
#Button The new toolbar button identifier.
ImageID The image to use for the button. It can be easily obtained by using ImageID() from the Image library. It can be an image loaded with LoadImage() or created in memory with CreateImage(). To have a real transparent background, use the 'icon' (.ico) file format on Windows, or the PNG file format on Linux/MacOS X.
Mode (optional) The mode value can be one of the following constants:
#PB_ToolBar_Normal: the button will act as standard button (default)
#PB_ToolBar_Toggle: the button will act as toggle button
GetToolBarButtonState() and SetToolBarButtonState() can be used to retrieve or modify a toggle button state.
Text$ (optional) The text to display with this button. The toolbar has to be created with the #PB_ToolBar_Text flag, or the text won't be displayed.
And obviously if you manually edit the form code to add the text then need to make other changes in the form designer, your text is wiped out!
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: ToolBarImageButton() and optional Text$ a no go

Post by Marc56us »

Hello Jimbob81,
Jimbob81 wrote:In the Form Designer when creating a ToolBar with image there appears to be no properties option to enter the optional text to display with ToolBarImageButton()
The FD is old and only handles 16x16 icons. A text can be added but as a ToolTip with the Caption property. The FD does not support new button templates (24x24 with text). You have to do them separately, in the main code.
Jimbob81 wrote: And obviously if you manually edit the form code to add the text then need to make other changes in the form designer, your text is wiped out!
Yeah, but it says so in the source.
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
The only things you can change manually in the code without deleting them are:
- Change numeric values
- Change content of the strings
- Delete items

PS. The FD is not perfect, but over the last 20 years many people have criticized it, tried to do better and none of them have finished... Personally, I use it every day. You just have to take the time to figure out what he can and can't do. Moreover, a Form is not tied to the file: you can modify the elements in the main code.
:wink:
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: ToolBarImageButton() and optional Text$ a no go

Post by Shardik »

Marc56us wrote:PS. The FD is not perfect, but over the last 20 years many people have criticized it, tried to do better and none of them have finished...
The FormDesigner is less then 8 years old. It was introduced with PB 5.00 in November 2012:
PureBasic news for PB 5.00 wrote:- Added: Brand new Form Designer, for Windows, Linux and OS X
Its predecessor was the VisualDesigner which was only available for Windows. Unfortunately a new version of the VisualDesigner with support for Linux had never been finished although an Alpha version 16 had been available for testing in 2008. The FormDesigner was cross-platform from its start.

Personally I still prefer to use the old VisualDesigner from PB 4.61. It still works with the latest PB 5.72... :wink:
Jimbob81
User
User
Posts: 18
Joined: Thu Jun 25, 2020 7:17 am

Re: ToolBarImageButton() and optional Text$ a no go

Post by Jimbob81 »

@Marc56us
Thanks for your post
Marc56us wrote: PS. The FD is not perfect, but over the last 20 years many people have criticized it, tried to do better and none of them have finished... Personally, I use it every day. You just have to take the time to figure out what he can and can't do. Moreover, a Form is not tied to the file: you can modify the elements in the main code.
:wink:
Yes, I've tried some of the other form designers but the one advantage FD has is that its built in to PB (for a while now) which makes it so convenient. Want to change/add/move something on the form - its right there. I can't say I use it everyday but certainly every project normally starts in the form designer for me and yeah I've had to learn REALLY quickly what it was all about cause it frustrated the hell out of me at first - and probably still does to some extent (hence my original post).

Its not till you change something or add something and try to use the form designer again do you realize that option/change/addition is not supported and you've just wasted time.... I've always found it fascinating that it never showed a popup box saying "unknown statement" or something to that effect as I am assuming it reloads the form each time you switch from form to code and back again...

I do understand that you can/must put form elements in the main code or other files etc and this is what I do now but I struggled with this concept as I liked to keep all form content to one file - maybe its my OCPD coming out :lol:

I see PB and FD source on GitHub so my intention for this post is to bring awareness to anyone who might be working on FD to look into the ToolBarImageButton() features... Pretty sure I got the right thread as I don't feel its a bug of any sort.

Not trying to be disrespectful to anyone here or the creation of FD... It would be a pain without a form designer.
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: ToolBarImageButton() and optional Text$ a no go

Post by Marc56us »

There's also a place where we have to do the code externally, it's for the status bar.
In fact, the FD always gives it a numerical value '0' and does not allow the use of a constant or a variable.
Therefore, with the FD you cannot make a status bar for each window if the project uses several windows.

I don't know if it's an oversight or if it's impossible to do.
\purebasic-master\PureBasicIDE\FormDesigner\
(I'm far from being good enough to recompile the IDE (I never even managed to install VisualStudio) :(
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: ToolBarImageButton() and optional Text$ a no go

Post by Shardik »

Marc56us wrote:(I'm far from being good enough to recompile the IDE (I never even managed to install VisualStudio) :(
It seems indeed to be difficult on Windows but you may try to recompile the IDE on Linux or MacOS where it is very easy. For MacOS I have even written a single script which does the download from GitHub and compilation automagically. It's just a matter of copying the script and starting it in your MacOS console...:wink:
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1243
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Re: ToolBarImageButton() and optional Text$ a no go

Post by Paul »

Marc56us wrote: PS. The FD is not perfect, but over the last 20 years many people have criticized it, tried to do better and none of them have finished.
This statement would be incorrect.
You can't criticize PureBasic's Form Designer for the last 20 years if it hasn't been available for that length of time ;)

I personally prefer to use PureVision. I use it daily on both personal and commercial projects and have been doing so for almost 20 years with this software and for me I can create forms quicker and easier than any other option out there. It has been around longer than any form designer provided with PureBasic and is still supported and updated today... and it also supports SpiderBasic.
Image Image
Post Reply