Jump to content

Can't change color of a tab or even add a element into it


TheHellTower
 Share

Go to solution Solved by Josh,

Recommended Posts

Hello, I wanted to change the color of my main tab, it didn't work then I wanted to add a text field, same..

When I comment the panels[1].SetColor, no color is set, but when I don't comment it, the color is set for all tabs.

So today I'm asking for your help to fix both, or are they broken(not working) ? Not sure..

Screenshot

Code:

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    auto displays = GetDisplays();

    auto window = CreateWindow("Joked", 0, 0, 800, 600, displays[0], WINDOW_TITLEBAR | WINDOW_CENTER);

    auto ui = CreateInterface(window);

    auto sz = ui->root->GetSize();


    auto tabber = CreateTabber(10, 10, sz.x - 20, sz.y - 20, ui->root);
    tabber->AddItem("Main", true);
    tabber->AddItem("Settings");

    std::array<std::shared_ptr<Widget>, 3> panels;
    sz = tabber->ClientSize();
    panels[0] = CreatePanel(0, 0, sz.x, sz.y, tabber);
    panels[0]->SetColor(54, 57, 63, 1);


    panels[1] = CreatePanel(0, 0, sz.x, sz.y, tabber);
    
    panels[1]->SetColor(0.1, 0.15, 0.1, 1);
    
    panels[1]->Hidden(true);
    
    auto textfield = CreateTextField(20, 20, 300, 32, panels[0], TEXTFIELD_DEFAULT);
    textfield->SetText("Here is some text!");
    textfield->SelectText(0, textfield->text.size());

    
    //auto scriptEditing = CreateTextField(20, 20, 400,40, ui->root);
 
    while (true)
    {
        const Event ev = WaitEvent();
        switch (ev.id)
        {
            case EVENT_WIDGETACTION:
                Print("Item " + String(ev.data) + " action");
                break;
            case EVENT_WIDGETSELECT:
                if (ev.source == tabber)
                {
                    for (int n = 0; n < tabber->items.size(); ++n)
                    {
                        n == ev.data ? panels[n]->Hidden(false) : panels[n]->Hidden(true);
                    }
                }
                break;
                break;
            case EVENT_QUIT:
            case EVENT_WINDOWCLOSE:
                return 0;
                break;
            default: break;
        }
    }
    return 0;
}

 

Regards.

Edited by TheHellTower
Add detail
Link to comment
Share on other sites

  • Solution

Here you go. :D

You were calling Hidden() instead of Hide/Show().

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    auto displays = GetDisplays();

    auto window = CreateWindow("Joked", 0, 0, 800, 600, displays[0], WINDOW_TITLEBAR | WINDOW_CENTER);

    auto ui = CreateInterface(window);

    auto sz = ui->root->GetSize();


    auto tabber = CreateTabber(10, 10, sz.x - 20, sz.y - 20, ui->root);
    tabber->AddItem("Main", true);
    tabber->AddItem("Settings");

    std::array<std::shared_ptr<Widget>, 3> panels;
    sz = tabber->ClientSize();
    panels[0] = CreatePanel(0, 0, sz.x, sz.y, tabber);
    panels[0]->SetColor(54.0 / 255.0, 57.0 / 255.0, 63.0 / 255.0, 1);


    panels[1] = CreatePanel(0, 0, sz.x, sz.y, tabber);

    panels[1]->SetColor(0.1, 0.15, 0.1, 1);

    panels[1]->Hide();

    auto textfield = CreateTextField(20, 20, 300, 32, panels[0], TEXTFIELD_DEFAULT);
    textfield->SetText("Here is some text!");
    textfield->SelectText(0, textfield->text.size());


    //auto scriptEditing = CreateTextField(20, 20, 400,40, ui->root);

    while (true)
    {
        const Event ev = WaitEvent();
        switch (ev.id)
        {
        case EVENT_WIDGETACTION:
            Print("Item " + String(ev.data) + " action");
            break;
        case EVENT_WIDGETSELECT:
            if (ev.source == tabber)
            {
                for (int n = 0; n < tabber->items.size(); ++n)
                {
                    n == ev.data ? panels[n]->Show() : panels[n]->Hide();
                }
            }
            break;
            break;
        case EVENT_QUIT:
        case EVENT_WINDOWCLOSE:
            return 0;
            break;
        default: break;
        }
    }
    return 0;
}

 

  • Haha 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

5 minutes ago, Josh said:

Here you go. :D

You were calling Hidden() instead of Hide/Show().

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    auto displays = GetDisplays();

    auto window = CreateWindow("Joked", 0, 0, 800, 600, displays[0], WINDOW_TITLEBAR | WINDOW_CENTER);

    auto ui = CreateInterface(window);

    auto sz = ui->root->GetSize();


    auto tabber = CreateTabber(10, 10, sz.x - 20, sz.y - 20, ui->root);
    tabber->AddItem("Main", true);
    tabber->AddItem("Settings");

    std::array<std::shared_ptr<Widget>, 3> panels;
    sz = tabber->ClientSize();
    panels[0] = CreatePanel(0, 0, sz.x, sz.y, tabber);
    panels[0]->SetColor(54.0 / 255.0, 57.0 / 255.0, 63.0 / 255.0, 1);


    panels[1] = CreatePanel(0, 0, sz.x, sz.y, tabber);

    panels[1]->SetColor(0.1, 0.15, 0.1, 1);

    panels[1]->Hide();

    auto textfield = CreateTextField(20, 20, 300, 32, panels[0], TEXTFIELD_DEFAULT);
    textfield->SetText("Here is some text!");
    textfield->SelectText(0, textfield->text.size());


    //auto scriptEditing = CreateTextField(20, 20, 400,40, ui->root);

    while (true)
    {
        const Event ev = WaitEvent();
        switch (ev.id)
        {
        case EVENT_WIDGETACTION:
            Print("Item " + String(ev.data) + " action");
            break;
        case EVENT_WIDGETSELECT:
            if (ev.source == tabber)
            {
                for (int n = 0; n < tabber->items.size(); ++n)
                {
                    n == ev.data ? panels[n]->Show() : panels[n]->Hide();
                }
            }
            break;
            break;
        case EVENT_QUIT:
        case EVENT_WINDOWCLOSE:
            return 0;
            break;
        default: break;
        }
    }
    return 0;
}

Thanks haha the tab example was not up to date so I did guess it was the good call

Link to comment
Share on other sites

You are using Ultra App Kit from Steam, right? It's an older build. There's a couple of small API changes that were made for Ultra Engine, which is basically UAK + Vulkan graphics.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

1 minute ago, Josh said:

You are using Ultra App Kit from Steam, right? It's an older build. There's a couple of small API changes that were made for Ultra Engine, which is basically UAK + Vulkan graphics.

Oh then how am I supposed to use the last version ? I would like to be up to date it's better in my opinion

Link to comment
Share on other sites

Well, UAK is free but Ultra Engine is not free:
https://www.ultraengine.com/community/store/category/1-software/

UAK is also compiled for Linux and Mac, but Ultra Engine does not yet support these platforms (although it is planned to in the future).

Also, UAK has a 64 and 32-bit build for Windows, but Ultra Engine is 64-bit only.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

2 minutes ago, Josh said:

Well, UAK is free but Ultra Engine is not free:
https://www.ultraengine.com/community/store/category/1-software/

UAK is also compiled for Linux and Mac, but Ultra Engine does not yet support these platforms (although it is planned to in the future).

Also, UAK has a 64 and 32-bit build for Windows, but Ultra Engine is 64-bit only.

Oh okay I see basically UAK is a kind of free version of Ultra Engine if I get it correctly !

Yeah for the moment I will not buy it, it's just for a small project in free access I can't really take this right now but why not later, is there any place where I can see detailed demo of Ultra Engine ?

Link to comment
Share on other sites

UAK was released about 1.5 years ago when I finished the GUI system but had not finished the full 3D engine yet, so I released what I had for GUI application development. Now that the full engine is released I decided to make UAK free.

Ultra Engine is currently in "early access" so there's no big demos of what it can do, but what it does offer is extremely good performance. You can try the benchmarks here if you like:
https://github.com/UltraEngine/Benchmarks

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

2 minutes ago, Josh said:

UAK was released about 1.5 years ago when I finished the GUI system but had not finished the full 3D engine yet, so I released what I had for GUI application development. Now that the full engine is released I decided to make UAK free.

Ultra Engine is currently in "early access" so there's no big demos of what it can do, but what it does offer is extremely good performance. You can try the benchmarks here if you like:
https://github.com/UltraEngine/Benchmarks

Yeah I like UAK's style and I'm glad I discovered it you did a amazing work ! So UAK is for C++ and Ultra Engine for .Net ? If yes sadly I will not be able to take it as I want to release a free access product without having to care too much about security since you can decompile .Net apps

Link to comment
Share on other sites

Well, right now it's an SDK. A visual editor is in development, and once that is out I think will mark the point where it will no longer be considered "early access":
https://www.ultraengine.com/community/blogs/entry/2801-ultra-engine-sdk-early-access-now-available/?tab=comments#comment-15305

I don't have an expected release date, but it's coming along pretty quickly.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

4 minutes ago, Josh said:

Well, right now it's an SDK. A visual editor is in development, and once that is out I think will mark the point where it will no longer be considered "early access":
https://www.ultraengine.com/community/blogs/entry/2801-ultra-engine-sdk-early-access-now-available/?tab=comments#comment-15305

I don't have an expected release date, but it's coming along pretty quickly.

Okay perfect, will Ultra Engine only be for games or will I be able to make a program GUI with it ? Since it will be the only updated I'm interested in it

Link to comment
Share on other sites

You can still use it just for a GUI application, without initializing graphics or requiring drivers. The executables are a little bit bigger than UAK, but still pretty small, around 6 mb when UPX compression is used.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

1 minute ago, Josh said:

You can still use it just for a GUI application, without initializing graphics or requiring drivers. The executables are a little bit bigger than UAK, but still pretty small, around 6 mb when UPX compression is used.

Perfect ! The final output size doesn't really matter for me as long as it work but yeah probably some users would like it to be optimized as much as possible and the smallest possible but it's not really that simple so it's perfect already -_-

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...