Jucer delete the default constructor


#1

How I can save default constructor

MainWindow :: MainWindow() : DocumentWindow (T("Hello World"), Colours::lightgrey, DocumentWindow::allButtons, true)
when I work with Jucer?
Jucer deleted

: DocumentWindow (T("Hello World"), Colours::lightgrey, DocumentWindow::allButtons, true)
when I save file! :cry:


#2

Put it in the “member initialisers” field in the jucer class info page.


#3

Jucer add metod

addAndMakeVisible (mb_play = new TextButton (T("new button")));

but it results in a mistake. I add manually

Component::addAndMakeVisible (mb_play = new TextButton (T("new button")));

Jucer deleted

Component::

and I need add it again…
What I can make to not repeat add it again?


#4

You can’t edit that bit - it’s generated by the jucer. Looks like it should work fine to me - why’s it giving an error?


#5

if you look at the header file generated, it states:

Be careful when adding custom code to these files, as only the code within the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded and re-saved.

so add your own code only inside those [xyz] sections and not outside them !


#6

I add new button in DocumentWindow. Jucer add the button with addAndMakeVisible metod? and when my programm is running I receive:
“juce_application.exe has triggered a breakpoint” and stop in

void ResizableWindow::addAndMakeVisible (Component* const child, int zOrder)
{
    /* Agh! You shouldn't add components directly to a ResizableWindow - this class
       manages its child components automatically, and if you add your own it'll cause
       trouble. Instead, use setContentComponent() to give it a component which
       will be automatically resized and kept in the right place - then you can add
       subcomponents to the content comp. See the notes for the ResizableWindow class
       for more info.

       If you really know what you're doing and want to avoid this assertion, just call
       Component::addAndMakeVisible directly.
   */
    jassertfalse //my programm is stopped

    Component::addAndMakeVisible (child, zOrder);
}

And I have to replaced addAndMakeVisible to Component::addAndMakeVisible…

When I use setContentComponent I have problem “Unhandled exception at 0x0051dd26 in juce_application.exe: 0xC0000005: Access violation reading location 0x0000001c.” in file “\src\juce_appframework\gui\graphics\geometry\juce_rectangle.h”

    /** Returns the width of the rectangle. */
    inline int getWidth() const throw()                     { return w; }

#7

I add new button in DocumentWindow. Jucer add the button with addAndMakeVisible metod? and when my programm is running I receive:
“juce_application.exe has triggered a breakpoint” and stop in

void ResizableWindow::addAndMakeVisible (Component* const child, int zOrder)
{
    /* Agh! You shouldn't add components directly to a ResizableWindow - this class
       manages its child components automatically, and if you add your own it'll cause
       trouble. Instead, use setContentComponent() to give it a component which
       will be automatically resized and kept in the right place - then you can add
       subcomponents to the content comp. See the notes for the ResizableWindow class
       for more info.

       If you really know what you're doing and want to avoid this assertion, just call
       Component::addAndMakeVisible directly.
   */
    jassertfalse //my programm is stopped

    Component::addAndMakeVisible (child, zOrder);
}

And I have to replaced addAndMakeVisible to Component::addAndMakeVisible…

When I use setContentComponent I have problem “Unhandled exception at 0x0051dd26 in juce_application.exe: 0xC0000005: Access violation reading location 0x0000001c.” in file “\src\juce_appframework\gui\graphics\geometry\juce_rectangle.h”

    /** Returns the width of the rectangle. */
    inline int getWidth() const throw()                     { return w; }

#8

I add new button in DocumentWindow. Jucer add the button with addAndMakeVisible metod? and when my programm is running I receive:
“juce_application.exe has triggered a breakpoint” and stop in

void ResizableWindow::addAndMakeVisible (Component* const child, int zOrder)
{
    /* Agh! You shouldn't add components directly to a ResizableWindow - this class
       manages its child components automatically, and if you add your own it'll cause
       trouble. Instead, use setContentComponent() to give it a component which
       will be automatically resized and kept in the right place - then you can add
       subcomponents to the content comp. See the notes for the ResizableWindow class
       for more info.

       If you really know what you're doing and want to avoid this assertion, just call
       Component::addAndMakeVisible directly.
   */
    jassertfalse //my programm is stopped

    Component::addAndMakeVisible (child, zOrder);
}

And I have to replaced addAndMakeVisible to Component::addAndMakeVisible…

When I use setContentComponent I have problem “Unhandled exception at 0x0051dd26 in juce_application.exe: 0xC0000005: Access violation reading location 0x0000001c.” in file “\src\juce_appframework\gui\graphics\geometry\juce_rectangle.h”

    /** Returns the width of the rectangle. */
    inline int getWidth() const throw()                     { return w; }

#9

I add new button in DocumentWindow. Jucer add the button with addAndMakeVisible metod? and when my programm is running I receive:
“juce_application.exe has triggered a breakpoint” and stop in

void ResizableWindow::addAndMakeVisible (Component* const child, int zOrder)
{
    /* Agh! You shouldn't add components directly to a ResizableWindow - this class
       manages its child components automatically, and if you add your own it'll cause
       trouble. Instead, use setContentComponent() to give it a component which
       will be automatically resized and kept in the right place - then you can add
       subcomponents to the content comp. See the notes for the ResizableWindow class
       for more info.

       If you really know what you're doing and want to avoid this assertion, just call
       Component::addAndMakeVisible directly.
   */
    jassertfalse //my programm is stopped

    Component::addAndMakeVisible (child, zOrder);
}

And I have to replaced addAndMakeVisible to Component::addAndMakeVisible…

When I use setContentComponent I have problem “Unhandled exception at 0x0051dd26 in juce_application.exe: 0xC0000005: Access violation reading location 0x0000001c.” in file “\src\juce_appframework\gui\graphics\geometry\juce_rectangle.h”

    /** Returns the width of the rectangle. */
    inline int getWidth() const throw()                     { return w; }

#10

Sorry, it’s my browser…


#11

You shouldn’t design a DocumentWindow in the jucer - use the jucer to build a normal component, and add that to a DocumentWindow as its content component.

I did explain this pretty clearly in that comment, didn’t I?


#12