Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - billarhos

#51
Yes labels, definitely labels for most people. But if you ask me i said buttons.

In photo you can see my labels and buttons all using outline on texts. In my code i support outline color and outline size as well
In my project i use tgui only for settings (a lot of pages) and not for the game itself.

But generally text outline would give every widget the artist tune

#52
Help requests / Re: unfocusing widgets
24 May 2019, 19:07:38
You can not satisfy every user but having a default status and also giving the ability to change the capability of focus (setFocusable) then you can catch every possible senario with much more cleaner and maintanaible source code.

thanks Texus
#53
Help requests / Re: unfocusing widgets
24 May 2019, 16:58:20
I thought for an instance that space and enter is a new functionality and maybe i should check my codes.

Quoteso I might as well add a function to disable using space and return keys to buttons
yes, this is also something i thought about.

QuoteSo if I could find a good way to allow the user to decide which widgets can gain focus

Perhaps a simple boolean is good enough. And you can leave up to user!

widget->setFocusable(bool onOff)

#54
Help requests / Re: unfocusing widgets
24 May 2019, 16:11:33
Maybe it would be good for some more functionality for buttons or other widgets:

button->addEventCodeTrigger(const sf::Keyboard & code); // add this code to a vector

button->removeEventCodeTriiger(const sf::Keyboard & code); remove this code from vector if exist

Texus can you tell me when this button functionality added. I mean from what version exist?


void Button::keyPressed(const sf::Event::KeyEvent& event)
    {
        if ((event.code == sf::Keyboard::Space) || (event.code == sf::Keyboard::Return))
            onPress.emit(this, m_text.getString());
    }
#55
What about considering using bitmap font rendering and may be using signed distance field (SDF) technique?
#56
General Discussion / About TGUI 0.9-dev
19 May 2019, 08:46:14
Hi Texus. Read in facebook about TGUI 0.9-dev and batching rendering. This is awsome!

In your post:
Quote
In release mode, TGUI 0.8 takes 0.25 seconds to render it while TGUI 0.9-dev reduces this to just 0.08 seconds (on a laptop with intel graphics).

One quarter of a second is too much time to render those few widgets. May be you meaning milliseconds? I have never seen those times in all past and current tgui versions.

Will tgui 0.9 continue to work as it is now? Will this be configurable, meaning select the way tgui renders?

What happens in future if tgui texts have outline color?



#57
General Discussion / Re: Menu with 3 level
08 April 2019, 12:09:53
One way is this

void CALLBACK menuBarClicked(tgui::MenuBar::Ptr /*menu*/)
{
// backup clicked
}
MenuBar1->connectMenuItem({ "File", "Save", "Backup" }, &menuBarClicked, MenuBar1);


or alternatively


MenuBar1->connectMenuItem({ "File", "Save", "Backup" }, [&]()
{
// backup clicked
});



#58
General Discussion / Re: Menu with 3 level
04 April 2019, 16:55:21
Hi

do something like that:

menu->addMenuItem({ "File", "Save", "Backup" });
#59
General Discussion / Re: New signal system
03 March 2019, 20:13:42
QuoteThis is very flexible as the string could be read from a text file. The downside is that typos aren't caught at compile time.

Can static assertion caught typos?

https://en.cppreference.com/w/cpp/language/static_assert
#60
General Discussion / Re: New signal system
03 March 2019, 19:11:12
http://en.fairygui.com/

Fairygui is a Cross Platform UI Editor & UI framework. I 've downloaded last year but never had the chance to use it. Looking at the signal source code, they tend to use const
integers. I don't know how this can be delivered in handling signal functions from txt files but this is an alternative to constant strings. Is more like enums. However in user source code they use direct naming functions. Like this:

_view->getChild("n2")->addClickListener([this, bagBtn](EventContext*){ });
#61
like this:


namespace tgui
{
#define IMPROVED_ENUM_NAME  ChildWindowConnect
#define IMPROVED_ENUM_LIST ENUMITEM(Closed) \
      ENUMITEM(Mimimize) \
      ENUMITEM(Focus)
#include "defineImprovedEnum.h"
}

childWindow->connect(tgui::ChildWindowConnect::Closed, [] {});

//in your code
connect(tgui::ChildWindowConnect::EnumType connectType, ..);


#62
Had u any time to look at improved enum?
The only disadvantage is that strings in txt file should be case sensitive.



STATIC_METHOD inline const ENUMSTRING Enum2String(const EnumType& t)
STATIC_METHOD inline const ENUMSTRING Enum2FullString(const EnumType& t)
STATIC_METHOD inline const EnumType String2Enum(const ENUMSTRING& s)
STATIC_METHOD inline const EnumType FullString2Enum(const ENUMSTRING& s)
STATIC_METHOD inline const EnumType NextEnumItem(const EnumType& t)
STATIC_METHOD inline const EnumType PreviousEnumItem(const EnumType& t)
STATIC_METHOD inline const int NumberOfValidEnumItem()

//EXAMPLE
state = LangPageState::PreviousEnumItem(state);

if (state == LangPageState::NotValidEnumItem)
{

}
else
{

}

//----------------------------------------------------------------------------------
#define IMPROVED_ENUM_NAME  TextureAlign
#define IMPROVED_ENUM_LIST   ENUMITEM(ALIGN_NONE) \
ENUMITEM(ALIGN_EXPAND) \
ENUMITEM(ALIGN_LEFT) \
ENUMITEM(ALIGN_RIGHT)         \
ENUMITEM(ALIGN_TOP) \
ENUMITEM(ALIGN_BOTTOM) \
ENUMITEM(ALIGN_BOTTOM_RIGHT)
#include "defineImprovedEnum.h"


//----------------------------------------------------------------------------------
#define IMPROVED_ENUM_NAME  ccTalkFlags
#define IMPROVED_ENUM_LIST ENUMITEM_VALUE(Log, 1) \
ENUMITEM_VALUE(ErrorLog, 2) \
ENUMITEM_VALUE(BoxMessage, 4) \
ENUMITEM_VALUE(TextMessage, 8) \
ENUMITEM_VALUE(Acknowledge, 16) \
ENUMITEM_VALUE(Reset, 32)
#include "defineImprovedEnum.h"
#63
QuotechildWindow->onClose.connect([]{});

The above declaration isn't easy to be found if you looking for the signals.

QuotechildWindow->connect.onClose([]{});
QuotechildWindow->connect.onShow([]{});
QuotechildWindow->connect.onMinimize([]{});

These are much more clarified for me but i don't know if it can be implemented in your current code.

I would prefer constants or enums for the general purpose since signals should be loaded from txt file.
#64
Let me think about it.
In meantime think about enums.
Instead of string and constants you can use enums and along with some inline functions you can easily check validness or you can use "defineImprovedEnum.h".
I use it all the time.


https://www.codeproject.com/Articles/32000/Improving-C-Enums-Adding-Serialization-Inheritance?msg=3818041#xx3818041xx
#65
Defining constants is a brilliant idea and this can eliminate stupid errors like mine. Adding a web page with all signals on the other hand, will be very helpful but not necessary if you implement constants.


#66
My silly mistake!!

I had opened "Editbox.hpp" to find the signal strings but i was using textbox instead of editbox!

In the future can you gather all signal strings for all widgets in on hpp file? is my thought correct?
#67
like this:

void CALLBACK pressedFunc(tgui::TextBox::Ptr box)
{

}


Tip: I do not use both connect functions at once in my code. I just used one at a time. But both has given me exception.
#68

pTextBox->connect("ReturnKeyPressed", [&]()
{

});

pTextBox->connect("ReturnKeyPressed", pressedFunc, pTextBox);


both above declarations are giving me an exception.

Quote
Exception thrown at 0x743B18A2 in Tgui.exe: Microsoft C++ exception: tgui::Exception at memory location 0x0113EA68.
Unhandled exception at 0x743B18A2 in Tgui.exe: Microsoft C++ exception: tgui::Exception at memory location 0x0113EA68.

in
Quoteunsigned int SignalWidgetBase::connect(std::string signalName, Func&& handler, const Args&... args)

I am using the day before yesterday's patch. (before "right click" in listview fixed)

Missing something?


#69
Feature requests / Re: listview and add item
28 February 2019, 11:24:29
Check this out



#if defined NDEBUG
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
#endif

#define USE_TGUI
#include "SFML_libs.hpp"

#include <TGUI/TGUI.hpp>

using namespace std;

bool running = true;

//https://scitechdaily.com/chandra-solves-the-universes-missing-mass-problem/
const std::string dataStr =
{
"New results from NASA’s Chandra X - ray Observatory may have helped solve the Universe’s “missing mass” problem. Astronomers cannot account for about a third of the normal matter â€" that is, hydrogen, helium, and other elements â€" that were created in the first billion years or so after the Big Bang."
"Scientists have proposed that the missing mass could be hidden in gigantic strands or filaments of warm(temperature less than 100,000 Kelvin) and hot(temperature greater than 100,000 K) gas in intergalactic space.These filaments are known by astronomers as the “warm - hot intergalactic medium” or WHIM."
"They are invisible to optical light telescopes, but some of the warm gas in filaments has been detected in ultraviolet light.The main part of this graphic is from the Millennium simulation, which uses supercomputers to formulate how the key components of the Universe, including the WHIM, would have evolved over cosmic time."
"If these filaments exist, they could absorb certain types of light such as X - rays that pass through them.The inset in this graphic represents some of the X - ray data collected by Chandra from a distant, rapidly - growing supermassive black hole known as a quasar.The plot is a spectrum â€" the amount of X - rays over a range"
"of wavelengths â€" from a new study of the quasar H1821 + 643 that is located about 3.4 billion light years from Earth."
"The latest result uses a new technique that both hones the search for the WHIM carefully and boosts the relatively weak absorption signature by combining different parts of the spectrum to find a valid signal.With this technique, researchers identified 17 possible filaments lying between the quasar and Earth, and obtained their distances."
};

bool matchCase(false);
bool matchWholeWord(false);

std::string::size_type  search_Index = std::string::npos;

std::string lower_string(const std::string& str)
{
string lower;
if (matchCase)
lower = str;
else
transform(str.begin(), str.end(), std::back_inserter(lower), tolower);
return lower;
}

std::string::size_type find_str_ci(const std::string& str, const std::string& substr)
{
if (matchWholeWord)
{
string findStr = " " + substr + " ";
return lower_string(str).find(lower_string(findStr));
}
return lower_string(str).find(lower_string(substr));
}

//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "TGUI window");
window.setFramerateLimit(60);

tgui::Gui gui(window);

auto pTextBox = tgui::TextBox::create();
pTextBox->setPosition(50, 100);
pTextBox->setSize(700, 470);
pTextBox->setTextSize(16);
pTextBox->setText(dataStr);
gui.add(pTextBox);

auto pSearchTextBox = tgui::TextBox::create();
pSearchTextBox->setPosition(50, 50);
pSearchTextBox->setSize(200, 30);
pSearchTextBox->setTextSize(16);

pSearchTextBox->connect("TextChanged", [&]()
{
search_Index = find_str_ci(dataStr.c_str(), pSearchTextBox->getText().toAnsiString().c_str());

if (search_Index != std::string::npos)
{
pTextBox->setSelectedText(matchWholeWord ? search_Index + 1: search_Index, matchWholeWord ? search_Index + pSearchTextBox->getText().toAnsiString().size() + 1 : search_Index + pSearchTextBox->getText().toAnsiString().size());
}
else
{
pTextBox->setSelectedText(0, 0);
}
});
gui.add(pSearchTextBox);

auto pCheckBoxCase = tgui::CheckBox::create();
pCheckBoxCase->setPosition(300, 50);
pCheckBoxCase->setText("Match case");
pCheckBoxCase->setSize(25, 25);
pCheckBoxCase->connect("Changed", [&]()
{
matchCase = !matchCase;
pTextBox->setSelectedText(0, 0);
pSearchTextBox->setText("");
});
gui.add(pCheckBoxCase);

auto pCheckBoxWord = tgui::CheckBox::create();
pCheckBoxWord->setPosition(470, 50);
pCheckBoxWord->setText("Match whole word");
pCheckBoxWord->setSize(25, 25);
pCheckBoxWord->connect("Changed", [&]()
{
matchWholeWord = !matchWholeWord;
pTextBox->setSelectedText(0, 0);
pSearchTextBox->setText("");
});

gui.add(pCheckBoxWord);

while (running)
{
sf::Event event;
while (window.pollEvent(event))
{
switch (event.type)
{
case sf::Event::Closed:
{
running = false;
}
break;
case sf::Event::MouseButtonPressed:
{

}
break;
case sf::Event::KeyPressed:
{
if (event.key.code == sf::Keyboard::Escape)
running = false;
break;
}
}

gui.handleEvent(event);
}

window.clear(sf::Color(200, 200, 200, 255));
gui.draw();
window.display();
}

return EXIT_SUCCESS;
}
#70
Feature requests / Re: listview and add item
27 February 2019, 15:01:53
QuoteMaybe a highlighted text is identical with selected text. And there is selected text in text box.

My mistake. In this phrase i should added one more sentence. This phrase:

QuoteSo you can use selected text instead of highlight text.

So, forget everything about "hightlighted" text.

A function like setSelectedText(size_t indexBegin, size_t sizeLetters) can be used in any case of making (in our code) a search functionality. After all in textbox there is a "getSelectedText" function.

I realize that "setHorizontalAlignment and setVerticalAlignment for textbox" were missing when yesterday i tried to make an example while we were talking about searching functionality in textboxes. I overcome this lack by declearing bigger font size. But at the end i never finished this example due to lack of "setSelectedText" function.



#71
Feature requests / Re: listview and add item
26 February 2019, 21:39:08
A "setSelectedText(size_t indexBegin, size_t sizeLetters)" function for textbox widget would be useful in many cases.

Also can not found setHorizontalAlignment and setVerticalAlignment for textbox. Have you miss them for any particular reason?


#72
Feature requests / Re: listview and add item
26 February 2019, 20:39:03
Maybe a highlighted text is identical with selected text. And there is selected text in text box.

Normally the search in a listview apply to all columns but also this is not a huge handicap .

And yes everything that i thought about can be implemented in our code. ;D
#73
Feature requests / Re: listview and add item
26 February 2019, 20:03:42

QuoteAlso this functionality can be added to current "textbox"

So a search box is actually a text box. Just see on top right on visual studio or press "ctrl+F" in notepad. The text found (if found) is highlighted! Easy!

However in a listview the lines-rowes that does not contain the request searched string must be excluded.
#74
Feature requests / Re: listview and add item
26 February 2019, 14:59:32
I know that listview is a demanding widget. A lot can be done in future to improve speed and functionality. For example, it would be great to add a "search-text-box" in new widgets in trello. Even windows does not have this widget. Searching a "listview" for a specific text can be done by binding a "listview" widget with a "searchbar" widget and easily exclude rows to show results. Also this functionality can be added to current "textbox" and also expanded for labels or text boxes where people need to look for a specific string. (aka ctrl+f)
#75
Feature requests / Re: listview and add item
25 February 2019, 21:43:18
That is quite fast. How many columns your test have? Have you made any test with 5 or more columns?