How to Use ToolbarItemComponent, ToolbarItemPalette


#1

I m trying to create toolbar…

I am very confused with the JUCE toolbar architecture…

I m not able to understand which component to add. i.e.,Toolbar or ToolbarItemPalette

And where to add??? I guess its in Main component

Please guide me…

Regards,
Sandy


#2

Have you had a look at the toolbar stuff int the juce demo app? It shows both of those classes in use.


#3

I think, the ‘Widgets/Toolbars’ works not well. Sometimes, when I move over the icons, they show me with a blue color,
that they are selected, sometimes not.

Thomas


#4

[quote=“ThomasM”]I think, the ‘Widgets/Toolbars’ works not well. Sometimes, when I move over the icons, they show me with a blue color,
that they are selected, sometimes not.

Thomas[/quote]

Hmm, haven’t seen that myself - any tips for reproducing it?


#5

[quote=“jules”][quote=“ThomasM”]I think, the ‘Widgets/Toolbars’ works not well. Sometimes, when I move over the icons, they show me with a blue color,
that they are selected, sometimes not.

Thomas[/quote]

Hmm, haven’t seen that myself - any tips for reproducing it?[/quote]
For example:
Move the mouse over the new document icon, move then out, then in…
so move inside and outside the same icon.
Oh, I found it! During the mouse movement I can see, that the selection area is to small or so.
I move the mouse from bottom to top, to the new doc icon and when the mouse is in the icon area,
it will change the color. But when I move on to the top, it change the color back (unselected).
Please, see images:
[attachment=2]Start.png[/attachment][attachment=1]Entry.png[/attachment][attachment=0]Move on.png[/attachment]

Thomas


#6

Sigh… I fixed that problem MONTHS ago.

PLEASE check the latest version before reporting bugs. This kind of outdated post just wastes everybody’s time.


#7

[quote=“jules”]Sigh… I fixed that problem MONTHS ago.

PLEASE check the latest version before reporting bugs. This kind of outdated post just wastes everybody’s time.[/quote]
:?:
I have compiled with the stable version v2.0.21 (from Sourceforge) and Visual Studio 2010 Express.
As I have seen (days before), that it’s possible to update to the new module version with the Introjucer very easy,
I tried it. I compiled the Jucer with the new version and it fails, the Demo too. So I have only the stable version v2.0.21
for the Demo.
Where can I get the current Demo version?
With the Introjucer updater I can get only the current modules.
Git? I have no git installed, sorry.

I repeat again and it was the first thing that I was annoyed when I started with Juce:
I can’t build the Jucer or the Demo only with the updated modules via the Introjucer Updater!
There are changes in the modules which affect the Jucer and the Demo (I have not tried yet to compile the Introjucer).
After that, I have installed the stable version again and build all extras, to have runable versions.

Thomas


#8

Go here to GitHub and click on the “Zip” button just above the “Files” tab. That will give you the most up to date JUCE version. Recompile the JuceDemo and Introjucer from the extras folder.

But really, just install mysysgit. Its dead small and quick and you will then be able to update your whole JUCE directory with a simple “git pull”.


#9

Jules,

Y dont u consider passing factory into the Toolbar???

And we need to call add default items explicitly… This is annoying…


#10

We’re up to 2.0.25 now, but the latest introjucer should be able to download that version of the modules for you.

BTW, as I mentioned elsewhere I am shortly going to add some auto-update functionality for the introjucer, as there do seem to be a bizarre number of GIT-refuseniks out there! (But honestly, to be a programmer these days and not even have GIT installed seems a bit odd… Even if you don’t like it, it’s such a pervasive part of modern development that you can’t just ignore it)

Sorry, I don’t understand your point…


#11

[quote=“dave96”]Go here to GitHub and click on the “Zip” button just above the “Files” tab. That will give you the most up to date JUCE version. Recompile the JuceDemo and Introjucer from the extras folder.

But really, just install mysysgit. Its dead small and quick and you will then be able to update your whole JUCE directory with a simple “git pull”.[/quote]
Thanks!
Downloaded the ‘julianstorer-JUCE-2_0_release-401-g9961c99.zip’ opened the
Introjucer project in Visual Studio 2010 Express and the build fails, because:
'julianstorer-juce-9961c99\modules\juce_gui_extra\code_editor\juce_cpluspluscodetokeniserfunctions.h(548):
error C2864: ‘juce::CppTokeniserFunctions::StringIterator::numChars’ : only static const integral data members can be initialized within a class’
From the ‘juce_CPlusPlusCodeTokeniserFunctions.h’:

/** A class that the tokeniser can use to parse a string. */
    struct StringIterator
    {
        StringIterator (const String& s) noexcept                  : t (s.getCharPointer()) {}
        StringIterator (const String::CharPointerType& s) noexcept : t (s) {}

        juce_wchar nextChar() noexcept      { if (isEOF()) return 0; ++numChars; return t.getAndAdvance(); }
        juce_wchar peekNextChar()noexcept   { return *t; }
        void skip() noexcept                { if (! isEOF()) { ++t; ++numChars; } }
        void skipWhitespace() noexcept      { while (t.isWhitespace()) skip(); }
        void skipToEndOfLine() noexcept     { while (*t != '\r' && *t != '\n' && *t != 0) skip(); }
        bool isEOF() const noexcept         { return t.isEmpty(); }

        String::CharPointerType t;
        int numChars = 0;
    };

Thomas


#12

Damn, I’ve started getting into the habit of using new c++11 features like class member initialisers… That’s fixed now, thanks.


#13

With the ‘julianstorer-JUCE-2_0_release-402-g3c34599.zip’, Visual Studio 2010 Express, release version, the Introjucer and the Demo works.

And the toolbar example works fine. :slight_smile:

Thomas


#14

i mean in Toolbar class we have following methods which take ToolbarItemFactory as argument.

void addItem (ToolbarItemFactory& factory, int itemId, int insertIndex = -1);

void addDefaultItems (ToolbarItemFactory& factoryToUse);

void showCustomisationDialog (ToolbarItemFactory& factory, int optionFlags = allCustomisationOptionsEnabled);

bool restoreFromString (ToolbarItemFactory& factoryToUse,const String& savedVersion);

why dont you change the Toolbar to accept ToolbarItemFactory as argument.

Regards,
Sandy


#15

I’ve still no idea what you’re talking about… You’re saying “why doesn’t it take the factory as an argument”, but those methods you quoted already do take the factory as an argument…(?)


#16

Jules just make constructor of Toolbar as

Toolbar ( ToolbarItemFactory& factoryToUse );

I cant explain more than this…


#17

But then your factory object would have to exist for the lifetime of the toolbar, which might not be appropriate in many cases.


#18

so every time i have to create tool bar item i need to pass the factory… Is this appropriate…


#19

I don’t understand why you think it’s a problem?