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 - starkhorn

#1
Help requests / ListBox sounds
10 June 2016, 06:21:13
Hi Texus,

So I have a listbox setup fine but I wanted to play a sound when my mouse hovered over an item and also when an item was selected.
Now I think I can trap the item selected easily enough using the ItemSelected signal but what signal can be used when hovering over an item in a listbox? Is it the widgets MouseEntered ? Does that get triggered each time the mouse enters an item?

#2
Hi Texus,

I was using Textboxes but I found I could not alter the colour of specific lines of a text and I could not put them into columns. So instead I have created a panel and adding Labels to the panel.

However one thing that I was missing is that the textbox had a nice border around it's panel. Is there an easy way to add this to a panel?
#3
argghhh - thank you.
#4
Help requests / Re: table widget
26 April 2016, 05:49:09
Hi Texus,

This might be a little beyond me. I'm getting lots of linking errors when trying to copying the table class to my code but I am slowly working through it. However bear with me, I will get back to trying this again.
#5
I'm having trouble getting a scrollbar to appear when adding it to a child window container.
In drawStartTurnSummarySubMenu, I create the child window with the setupChildWindow method.
I then try to add a scrollbar to the child window using setupScrollBarHorz and passing the child window as a container.
I can see that the number of widgets in the child window increases when I add the scrollbar but it never appears. (Note I put autohide to false).
However if I change the line in setupScrollBarHorz

Code (cpp) Select

container->add(scrollbar, scrollBarName);


To the below, the scollbar appears.
Code (cpp) Select

//gui.add(scrollbar, scrollBarName);


However if I move the childwindow the position of the scrollbar doesn't move. Basically I want the scrollbar to control widgets inside a panel which inside a child window. Here are the methods in question.

Code (cpp) Select


void Test::drawStartTurnSummarySubMenu()
{
sf::Vector2i pos(gameWindow.getSize().x * 0.1, gameWindow.getSize().y * 0);
sf::Vector2i size((gameWindow.getSize().x - (gameWindow.getSize().x * 0.25)), gameWindow.getSize().y * 0.750);

setupChildWindow(pos, size, "Start Turn Summary", sf::Color::Red, "startTurn");
tgui::Container::Ptr container = gui.get<tgui::Container>("startTurn");

pos = sf::Vector2i(0, 0);
void (Test::*ptrToMember)(const tgui::Callback&) = NULL; // creating function ptr
ptrToMember = &Test::scrollBarHorzSignalFunction; // assigning function ptr to appropraite function

setupScrollBarHorz("regionPanelScrollHorz", ptrToMember, container);

//clear game window
gameWindow.clear();

gui.draw();
gameWindow.display();
}

void Test::setupChildWindow(sf::Vector2i pos, sf::Vector2i size, string title_text, sf::Color titleText_Color, string passed_childName)
{
if (gui.get(passed_childName) == NULL)
{
tgui::ChildWindow::Ptr childWin = theme->load("ChildWindow");
childWin->setPosition(pos.x, pos.y);
childWin->setSize(size.x, size.y);
childWin->getRenderer()->setTitleColor(titleText_Color);
childWin->setTitle(title_text);
gui.add(childWin, passed_childName);
}
}

bool Test::setupScrollBarHorz(string scrollBarName, void (Test::*ptrToMember)(const tgui::Callback&),tgui::Container::Ptr container)
{
if ((container != NULL && container->get(scrollBarName) == NULL) || (container == NULL && gui.get(scrollBarName) == NULL))
{
tgui::Scrollbar::Ptr scrollbar = theme->load("Scrollbar");
scrollbar->setPosition(container->getPosition() + sf::Vector2f(container->getSize().x, 0));
scrollbar->setSize(20, container->getSize().y);
scrollbar->connectEx("ValueChanged", ptrToMember, this);
scrollbar->setAutoHide(false);
container->add(scrollbar, scrollBarName);
//gui.add(scrollbar, scrollBarName);
return true;
}
else
{
return false;
}
}

void Test::scrollBarHorzSignalFunction(const tgui::Callback& callback)
{
int scrollbarMove = callback.value;
}
#6
Help requests / Re: table widget
22 April 2016, 03:26:11
wow ok, it might take me a while to go through that all but I will give it a go.

One more thing about tables, can you click on a row and trigger an event?
#7
Help requests / table widget
22 April 2016, 01:04:24
Hi Texus,

I was looking at the table.cpp for the new table widget. It looks awesome.

I want to put it into a child window which I can do easily enough but I was wondering if there is a way to get a scroll bar both vertical and horizontal on that?
#8
Table looks awesome. I have a question on it but I'll start a new thread for that :)
#9
Quote from: texus on 28 September 2015, 22:47:16
About the multi-column feature, it has been requested several times with small variations. I guess I will really have to try to add it in 0.7, even though it will be a lot of work to make the widget fit all different use cases.

I think that the first request already dates back 1.5 or even 2 years ago, the github issue is almost a year old as well.

I'll try to make sure that it gets priority and should make it in 0.7-RC, I can't keep delaying it.

Hi Texus,

I know this is an old topic but I was wondering if the above new feature made it into v0.7 release? Specifically the multi-column feature in a listbox.
#10
Actually I should have just tested it before posting....sorry. :(

I had the below and it works fine.

Code (cpp) Select

Button.CustomButtonNonClickRomeHI {
    NormalImage  : "..\images\icons\romeNationIcon_v3.png" Part(  56,  0,  48, 64);
    TextColorNormal : rgb(190, 190, 190);
}


I ensure when setting up the button to call the below to disable, disconnect etc and it works well.

Code (cpp) Select

gui.get(buttonText, true)->disconnectAll();
gui.get(buttonText, true)->disable();
gui.get<tgui::Button>(buttonText, true)->setText("");
#11
Help requests / Optional custom widget config
06 April 2016, 00:58:49
Hi Texus,

I was wondering if you could advise if any of the below config is optional? As you can see I basically want the RGB and image to be the same for normal, hover and down events. I have alot of these widgets to create in the conf file so I was wondering if there was a way to remove optional parameters? i.e. if HoverImage isn't present will it use the normalImage by default etc?

Code (cpp) Select

Button.CustomButtonNonClickRomeHI {
    NormalImage  : "..\images\icons\romeNationIcon_v3.png" Part(  56,  0,  48, 64);
    HoverImage   : "..\images\icons\romeNationIcon_v3.png" Part(  56,  0,  48, 64);
    DownImage    : "..\images\icons\romeNationIcon_v3.png" Part(  56,  0,  48, 64);
    TextColorNormal : rgb(190, 190, 190);
    TextColorHover  : rgb(190, 190, 190);
    TextColorDown   : rgb(190, 190, 190);
}
#12
Ok thanks. It might take me a while to download from github and recompile.
I am thinking for right now to create a customer button widget where the hover, normal and down images/rgb are all the same. Also I won't connect any signal function to it....that essentially will just leave an unclickable button.
#13
Ok thanks, I'll give the custom widget a go and see how I get on.

Quote from: texus on 04 April 2016, 11:21:32
It isn't possible directly, Cavas was created exactly for these cases where you needed to do this.

I guess I am struggling now to understand why there is a canvas in order to do sfml sprites, texts etc directly. Is there any reason why we cannot simply draw these items to gui or containers directly, i.e. why the need for an extra layer?

Obviously I know the canvas issue is specific to my graphics card but I would just find it much easier to draw directly to containers rather than needing to have another layer in there.
#14
Help requests / v0.7 using the tgui::picture
05 April 2016, 08:46:32
Hey Texus,

So I want to setup a picture using a texture. However I only want to set the picture to have the picture defined in a sf::IntRect.
Basically I have a sprite that has it's setTextureRect to a subset of a larger texture, and I want the tgui::picture to only display this subset/IntRect.

I don't see a setTextureRect method in tgui::picture so I was wondering if there was a way to do it? Again this is me trying to get around using canvas due to the blinking issue with my graphics card. So instead of sprites, I am trying to use tgui::pictures.
#15
Hi Texus,

Ok so I have replaced nearly all of what I was doing/drawing onto a canvas via labels or pictures. However one thing I cannot seem to replace easily is some sf::RectangleShape onto a child window.

Is there any way to do that in a childwindow without a canvas? I'm assuming no and that I will have to draw a picture with the border outline but I was hoping to avoid that if possible.