New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in saving data -> Picture and meany more issues #90

Closed
1aam2am1 opened this Issue Jan 13, 2019 · 21 comments

Comments

Projects
None yet
2 participants
@1aam2am1
Copy link

1aam2am1 commented Jan 13, 2019

When saving picture in form.txt:
Picture."Picture1" {
Enabled = false;
IgnoreMouseEvents = true;
Size = (716, 346.731);

Renderer {
    texture = data/raku2.png; //here is error it should be in "", because if it isn't then 
}

}
Failed to load 'form.txt', reason: Error while parsing input at line 14. Found empty value.
line 14 is the line with texture value.

@1aam2am1

This comment has been minimized.

Copy link
Author

1aam2am1 commented Jan 13, 2019

Could you add that a label and button text with /n is new line from form.txt?

@1aam2am1

This comment has been minimized.

Copy link
Author

1aam2am1 commented Jan 14, 2019

There is error in saving renderers, when saving White option it is saving it as custom one.

@1aam2am1

This comment has been minimized.

Copy link
Author

1aam2am1 commented Jan 14, 2019

There is error in editbox ReadOnly property is not saved and readed from form.txt
Combobox SelectedItemIndex

@1aam2am1 1aam2am1 changed the title Error in saving data -> Picture Error in saving data -> Picture and meany more issues Jan 14, 2019

@texus

This comment has been minimized.

Copy link
Owner

texus commented Jan 14, 2019

here is error it should be in "", because if it isn't then

It seems like the gui builder currently requires you to type these quotes inside the editor (they are there for the default picture too). This is definitely something that could be improved in the future, but I don't think the gui builder can differentiate between cases where it can add quotes and cases where it shouldn't add quotes yet. So just doesn't add quotes automatically.

Could you add that a label and button text with /n is new line from form.txt?

Button doesn't support newlines, in label you can already do it with \n, as long as there are quotes around the entire string.

There is error in saving renderers, when saving White option it is saving it as custom one.

The renderer isn't actually saved, when loading it tries to match all properties with one of the known renderers and selects Custom if it fails. With which widget is it happening? Do you have to make changes to the widget before it wrongly identifies it as Custom?

There is error in editbox ReadOnly property is not saved and readed from form.txt
Combobox SelectedItemIndex

SelectedItemIndex was intentionally not saved because I thought it would be weird to save which item is currently selected in your program, but I guess it can be wanted if the file is being saved by the gui builder. So I'll add this to ComboBox and to similar widgets (and I'll add the ReadOnly property to EditBox, which was just overlooked).

@1aam2am1

This comment has been minimized.

Copy link
Author

1aam2am1 commented Jan 14, 2019

This is definitely something that could be improved in the future, but I don't think the gui builder can differentiate between cases where it can add quotes and cases where it shouldn't add quotes yet. So just doesn't add quotes automatically.

It shouldn't do it, but by saving it without quotes. Your node parser is not working when reading. Therefore saving should add these to property save our widgets config.

in label you can already do it with \n, as long as there are quotes around the entire string.

image
In label it is not working while saving by gui-builder. In config it is automatically saved as \\n

The renderer isn't actually saved, when loading it tries to match all properties with one of the known renderers and selects Custom if it fails. With which widget is it happening? Do you have to make changes to the widget before it wrongly identifies it as Custom?

I don't need any changes at all. It works even when i only click in gui-builder to create widget in Toolbox.
Widget: I thing all. I have checked: Button, Checkbox, Combobox, Editbox.
In custom themes All hover properties are transparent.
image

SelectedItemIndex should be implemented because in example i want have selected item with index 0 with is in example "None" string. And in my program i will treat this position as nothing was selected.

@texus

This comment has been minimized.

Copy link
Owner

texus commented Jan 15, 2019

Therefore saving should add these to property save our widgets config.

I thought that the gui builder was literally writing the key-value pairs to the file, but it is using the saveWidgetsToFile function (which makes sense), so you are right that this is a bug in the saving code.

I'll fix this and the saving of SelectedItemIndex and ReadOnly this week.

In label it is not working while saving by gui-builder. In config it is automatically saved as \n

If you don't put quotes around it then it will be seen as a literal string. You have to put quotes around the Text property to make it parse the \n as a newline.

I don't need any changes at all. It works even when i only click in gui-builder to create widget in Toolbox.
Widget: I thing all. I have checked: Button, Checkbox, Combobox, Editbox.
In custom themes All hover properties are transparent.

If I just create a button, save the file and load it again then the theme still says "White". Same for edit box.

When I choose the custom theme it doesn't say transparent here anywhere, only "#000000". But either "transparent" or "#000000" is a bug. It seems like the gui builder doesn't handle properties that aren't assigned a value.

The gui builder hasn't been used a lot yet and I've been focusing more on the gui itself than on the gui builder, which is why there are some things that aren't working well yet. But I'm glad someone is finally providing feedback on the gui builder, so that I know which things need to be fixed.

@1aam2am1

This comment has been minimized.

Copy link
Author

1aam2am1 commented Jan 16, 2019

When I create label in gui-builder and set text to:
I set => I get when i load it in my program as form
line1\nline2 => line1\nline2
"line1\nline2" => "line1\nline2"
'line1\nline2' => 'line1\nline2'
line1"\n"line2 => line1"\n"line2
line1'\n'line2 => line1'\n'line2
Actual gui-builder translate \ to \ when saving to file. There fore there is no new line in gui-builder
When I edit manualy my form.txt to:
"line1\nline2" => line1
line2

Then everything works. But in gui-builder my text edit have two lines to.
image

I have finded new error: In editbox when we load it from form.txt the caret is not visible.

@texus

This comment has been minimized.

Copy link
Owner

texus commented Jan 16, 2019

I should have probably tested it myself before stating that you could just put quotes around it. I guess I'll have to change how the gui builder saves strings to a file then.

In editbox when we load it from form.txt the caret is not visible.

I'm not sure what behavior you are expecting. Only the focused edit box has a flickering caret, so obviously whether the caret is visible or not can't be saved. Do you mean that you want to be able to specify which widget should get the focus after loading a the file?

@1aam2am1

This comment has been minimized.

Copy link
Author

1aam2am1 commented Jan 16, 2019

No when I load editbox make it focused by clicking on it. The cared is not visible. But I can write to editbox normally. Like the cared was transparent.

@texus

This comment has been minimized.

Copy link
Owner

texus commented Jan 16, 2019

I think I understand what you mean, but I can't reproduce it. The caret shows up correctly for me. This is what I had in my saved form:

EditBox."Widget5" {
    Position = (370, 330);
    Size = (160, 22);
    TextSize = 13;

    Renderer {
        backgroundcolor = #F5F5F5;
        backgroundcolordisabled = #E6E6E6;
        backgroundcolorhover = white;
        bordercolor = #3C3C3C;
        bordercolordisabled = #7D7D7D;
        bordercolorhover = black;
        borders = (1, 1, 1, 1);
        caretcolor = black;
        caretwidth = 1;
        defaulttextcolor = #A0A0A0;
        padding = (0, 0, 0, 0);
        selectedtextbackgroundcolor = #006EFF;
        selectedtextcolor = white;
        textcolor = #3C3C3C;
        textcolordisabled = #7D7D7D;
        texture = None;
        texturedisabled = None;
        texturefocused = None;
        texturehover = None;
    }
}

Do you maybe have "transparent" as value for "caretcolor" or "0" for "caretwidth"? Did you do anything other than just creating an edit box and saving the form?

@1aam2am1

This comment has been minimized.

Copy link
Author

1aam2am1 commented Jan 16, 2019

I simply have:

EditBox."gp_moc" {
Enabled = true;
Position = (0, 60);
Size = (127, 20);
Text = "-";
TextSize = 12;
}

But if I copy your Renderer config then carriage returns to normal behavior.
I thing there is error with default values when the renderer config isn't written,

With the error of simply creating editbox with gui-builder saving it and loading it. And it load as custom one instead of White the config it is saving is:

EditBox."Widget1" {
Size = (160, 22);
TextSize = 13;
Renderer {
    backgroundcolor = #F5F5F5;
    backgroundcolordisabled = #E6E6E6;
    backgroundcolorhover = #00000000;
    bordercolor = #3C3C3C;
    bordercolordisabled = #7D7D7D;
    bordercolorhover = #00000000;
    borders = (1, 1, 1, 1);
    caretcolor = #00000000;
    caretwidth = 1;
    defaulttextcolor = #A0A0A0;
    padding = (0, 0, 0, 0);
    selectedtextbackgroundcolor = #006EFF;
    selectedtextcolor = #00000000;
    textcolor = #3C3C3C;
    textcolordisabled = #7D7D7D;
    texture = None;
    texturedisabled = None;
    texturefocused = None;
    texturehover = None;
}
}

When I delete Renderer part then it loads editbox as White config

@texus

This comment has been minimized.

Copy link
Owner

texus commented Jan 20, 2019

The following changes have been made:

  • The picture will now load correctly without the quotes.
  • ReadOnly property of EditBox and SelectedItemIndex in ListBox and ComboBox are saved in the widget file.
  • Colors can be set to an empty value. Previously the color would reset to "black", "#00000000", "transparent" or whatever value was there before.
  • Gui Builder will save the values seen in the edit boxes, not the values entered (e.g. if you make an edit box for a color property empty, the gui builder will change it to "None", but will now also save it as "None" instead of trying to save an empty value).

I have chosen not to support newlines in label at this point. This is a limitation that exists in other gui builders as well (including the one I use at work) and although it can be an annoyance, it isn't easy to work around properly (i.e. without adding some hack). At this point the gui builder sees all properties as strings and does not differentiate between e.g. colors and textures. When rewriting it in the future to e.g. add a color picker for colors, I will probably add some way to allow entering multiple lines of text for labels (e.g. by adding a small button with "..." as caption on the side of the edit box which would open a form where you can enter multiple lines). But for now you will have to change it manually in the form.txt file.

I've uploaded a new Gui Builder executable so that you can test it without having to rebuild it yourself. I couldn't reproduce issues where the renderer isn't being saved, but maybe it got fixed while making the other changes. If you still find some bugs then just let me know, but if everything works in the new version then you can close this github issue.

@1aam2am1

This comment has been minimized.

Copy link
Author

1aam2am1 commented Jan 21, 2019

The issue wasn't that the renderer wasn't saved. But that when there wasn't one. The widget would have transparent property in hover values.

Now everything works.

I have checked yours executable and i have built library anew. And i have seen something strange.
In yours build when loading form. Widgets would have White theme.

In my executable a custom one theme. Source code is the same therefore there shouldn't have been any differences.
Try my build.
gui-builder.zip

@texus

This comment has been minimized.

Copy link
Owner

texus commented Jan 21, 2019

I have no idea why the executables could be different, but I did notice that when closing your gui builder when there were still unsaved changes, the child window that asks you whether you want to save the file is broken. So there seem to be more issues with your executable.

I have a feeling that I've seen that child window broken before, but I can't recall any details about the situation. I would probably have dismissed something like that as a broken graphics driver, but having two executables now where one of them works proves that the problem lies elsewhere.

The executable I build was created with Visual Studio 2017 and 32-bit SFML 2.5.1 static release libraries downloaded from the SFML website.
What is the exact compiler and SFML version you are using? If you build the SFML libraries yourself then you can maybe upload them somewhere. I would like to test if the issue is reproducible if I use the exact same compiler and SFML version as you.

@1aam2am1

This comment has been minimized.

Copy link
Author

1aam2am1 commented Jan 21, 2019

Compiler: mingw-w64 => i686-7.3.0-posix-dwarf-rt_v5-rev0
SFML: SFML-master version from 27.11.2018 SFML lates comit: 2be4e54d4abca6f17b8a575bb5e60cd78341cbee
Build static with static library's.
SFML-2.5.1.zip

@texus

This comment has been minimized.

Copy link
Owner

texus commented Jan 22, 2019

I can't reproduce it even when using the same MinGW compiler and the SFML libraries from your zip file.
I'm not going to spend any more time looking into this.

@1aam2am1 1aam2am1 closed this Jan 22, 2019

@1aam2am1

This comment has been minimized.

Copy link
Author

1aam2am1 commented Jan 22, 2019

Maybe it is something with my computer.

@1aam2am1

This comment has been minimized.

Copy link
Author

1aam2am1 commented Jan 25, 2019

I have changed compiler to 8.1 Have build static and shared library's of sfml and tgui. (MASTER) and the same problem exists. I will try on weekend build on another computer. I think it this could have something to do with my windows version or computer.

@1aam2am1

This comment has been minimized.

Copy link
Author

1aam2am1 commented Jan 25, 2019

On mac sierra 10.12.6 xcode 9.2 gcc Apple LLVM version 9.0.0 (clang-900.0.39.2)

Application Specific Information:
abort() called
terminating with uncaught exception of type tgui::Exception: Signal 'MousePressed' could not provide data for unbound parameters.
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff91387d42 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff91475457 pthread_kill + 90
2 libsystem_c.dylib 0x00007fff912ed420 abort + 129
3 libc++abi.dylib 0x00007fff8fe4694a abort_message + 266
4 libc++abi.dylib 0x00007fff8fe6bc17 default_terminate_handler() + 243
5 libobjc.A.dylib 0x00007fff9097a353 _objc_terminate() + 124
6 libc++abi.dylib 0x00007fff8fe68d49 std::__terminate(void ()()) + 8
7 libc++abi.dylib 0x00007fff8fe687be __cxa_throw + 121
8 libtgui-d.0.8.2.dylib 0x000000010b6be888 tgui::Signal::validateTypes(std::initializer_liststd::__1::type_index) const + 424 (Signal.cpp:131)
9 libtgui-d.0.8.2.dylib 0x000000010b6c0b00 tgui::SignalVector2f::validateTypes(std::initializer_liststd::__1::type_index) const + 160 (Signal.cpp:217)
10 gui-builder 0x000000010b39275e tgui::internal_signal::binder<tgui::internal_signal::TypeSet<sf::Vector2 >, tgui::internal_signal::TypeSet<> >::bindImpl<Form::Form(GuiBuilder
, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::shared_ptrtgui::ChildWindow)::$_2, 0ul>(decltype(auto), std::__1::integer_sequence<unsigned long, 0ul>, tgui::Signal&, Form::Form(GuiBuilder*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::shared_ptrtgui::ChildWindow)::$_2&&) + 126 (SignalImpl.hpp:157)
11 gui-builder 0x000000010b392695 tgui::internal_signal::binder<tgui::internal_signal::TypeSet<sf::Vector2 >, tgui::internal_signal::TypeSet<> >::bind<Form::Form(GuiBuilder*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::shared_ptrtgui::ChildWindow)::$_2>(decltype(auto), tgui::Signal&, Form::Form(GuiBuilder*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::shared_ptrtgui::ChildWindow)::$_2&&) + 37 (SignalImpl.hpp:149)
12 gui-builder 0x000000010b379fd9 tgui::SignalWidgetBase::connect<Form::Form(GuiBuilder*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::shared_ptrtgui::ChildWindow)::$_2, (void*)0>(unsigned int, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, Form::Form(GuiBuilder*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::shared_ptrtgui::ChildWindow)::$_2&&) + 233 (SignalImpl.hpp:347)
13 gui-builder 0x000000010b377c4d Form::Form(GuiBuilder*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::shared_ptrtgui::ChildWindow) + 2893 (Form.cpp:48)
14 gui-builder 0x000000010b37af55 Form::Form(GuiBuilder*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::shared_ptrtgui::ChildWindow) + 37 (Form.cpp:64)
15 gui-builder 0x000000010b3baca6 GuiBuilder::loadEditingScreen(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 774 (memory:3006)
16 gui-builder 0x000000010b4d7ad8 GuiBuilder::loadStartScreen()::$_2::operator()() const + 72 (GuiBuilder.cpp:435)
17 gui-builder 0x000000010b4d7a7d void std::__1::__invoke_void_return_wrapper::__callGuiBuilder::loadStartScreen()::$_2&(GuiBuilder::loadStartScreen()::$_2&&&) + 45 (__functional_base:360)
18 gui-builder 0x000000010b4d7869 std::__1::__function::__func<GuiBuilder::loadStartScreen()::$_2, std::__1::allocatorGuiBuilder::loadStartScreen()::$_2, void ()>::operator()() + 41 (functional:1552)
19 gui-builder 0x000000010b38dfeb std::__1::function<void ()>::operator()() const + 123 (functional:1903)
20 gui-builder 0x000000010b4d97b5 unsigned int tgui::SignalWidgetBase::connect<GuiBuilder::loadStartScreen()::$_2, (void*)0>(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, GuiBuilder::loadStartScreen()::$_2&&)::'lambda'()::operator()() const + 21 (SignalImpl.hpp:323)
21 gui-builder 0x000000010b4d978d void std::__1::__invoke_void_return_wrapper::__call<unsigned int tgui::SignalWidgetBase::connect<GuiBuilder::loadStartScreen()::$_2, (void*)0>(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, GuiBuilder::loadStartScreen()::$_2&&)::'lambda'()&>(unsigned int tgui::SignalWidgetBase::connect<GuiBuilder::loadStartScreen()::$_2, (void*)0>(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, GuiBuilder::loadStartScreen()::$_2&&)::'lambda'()&&&) + 45 (__functional_base:360)
22 gui-builder 0x000000010b4d9569 std::__1::__function::__func<unsigned int tgui::SignalWidgetBase::connect<GuiBuilder::loadStartScreen()::$_2, (void*)0>(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, GuiBuilder::loadStartScreen()::$_2&&)::'lambda'(), std::__1::allocator<unsigned int tgui::SignalWidgetBase::connect<GuiBuilder::loadStartScreen()::$_2, (void*)0>(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, GuiBuilder::loadStartScreen()::$_2&&)::'lambda'()>, void ()>::operator()() + 41 (functional:1552)
23 libtgui-d.0.8.2.dylib 0x000000010b641b1b std::__1::function<void ()>::operator()() const + 123 (functional:1903)
24 libtgui-d.0.8.2.dylib 0x000000010b6917e6 tgui::Signal::emit(tgui::Widget const*) + 2790 (Signal.hpp:161)
25 libtgui-d.0.8.2.dylib 0x000000010b9052d8 tgui::SignalString::emit(tgui::Widget const*, sf::String const&) + 184 (Signal.hpp:305)
26 libtgui-d.0.8.2.dylib 0x000000010b9051ee tgui::Button::leftMouseReleased(tgui::Vector2f) + 94 (Button.cpp:222)
27 libtgui-d.0.8.2.dylib 0x000000010b661bb9 tgui::Container::handleEvent(sf::Event&) + 3577 (Container.cpp:914)
28 libtgui-d.0.8.2.dylib 0x000000010b662324 tgui::Container::leftMouseReleased(tgui::Vector2f) + 244 (Container.cpp:632)
29 libtgui-d.0.8.2.dylib 0x000000010baaafd6 tgui::Panel::leftMouseReleased(tgui::Vector2f) + 214 (Panel.cpp:146)
30 libtgui-d.0.8.2.dylib 0x000000010b661bb9 tgui::Container::handleEvent(sf::Event&) + 3577 (Container.cpp:914)
31 libtgui-d.0.8.2.dylib 0x000000010b68fd5c tgui::Gui::handleEvent(sf::Event) + 2364 (Gui.cpp:249)
32 gui-builder 0x000000010b3adbb7 GuiBuilder::mainLoop() + 695 (GuiBuilder.cpp:278)
33 gui-builder 0x000000010b3770bd main + 45 (main.cpp:30)
34 libdyld.dylib 0x00007fff91259235 start + 1

@texus

This comment has been minimized.

Copy link
Owner

texus commented Jan 25, 2019

Could you try and see what happens if you add #define TGUI_UNSAFE_TYPE_INFO_COMPARISON in include/TGUI/Config.hpp and recompile TGUI and the gui builder?

@1aam2am1

This comment has been minimized.

Copy link
Author

1aam2am1 commented Jan 25, 2019

Everything works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment