Hi!
My problem is that the code never enter in "while (gui.pollCallback(callback))" part. so buttons and objects never trigger
essential code ( I removed not tgui related parts ):
form.txt is :
My problem is that the code never enter in "while (gui.pollCallback(callback))" part. so buttons and objects never trigger
essential code ( I removed not tgui related parts ):
Code Select
int main(void)
{
// server - console
sf::RenderWindow window(sf::VideoMode(800, 600), "",sf::Style::Titlebar);
tgui::Gui gui(window);
if ( !gui.setGlobalFont("fonts/DejaVuSans.ttf") || !gui.loadWidgetsFromFile("widgets/form.txt") )
return 1;
while (window.isOpen())
{
sf::Event _event;
while (window.pollEvent(_event))
{
gui.handleEvent(_event);
tgui::Callback callback;
while (gui.pollCallback(callback))
{
if (callback.id == 1)
window.close();
}
window.clear();
gui.draw();
window.display();
}
}
gui.removeAllWidgets();
return 0;
}
form.txt is :
Code Select
// This file was generated by TGUI Form Builder v0.2.x - 2013.07.04
Window: ""
{
Button: "btnCloseServer"
{
ConfigFile = "widgets/Black.conf"
Position = (300,530)
Size = (200,50)
Text = "CloseServer"
TextSize = 27
TextColor = (200,200,200)
CallbackID = 1
}
CheckBox: "cbPassword"
{
ConfigFile = "widgets/Black.conf"
Position = (50,50)
Size = (32,32)
Checked = 0
Text = ""
TextSize = 32
TextColor = (200,200,200)
CallbackID = 0
}
Label: "lbpass"
{
Position = (50,20)
Text = "Server additional pass"
TextSize = 20
TextColor = (255,255,255)
BackgroundColor = (0,0,0,0)
CallbackID = 0
}
Button: "btnRefreshpass"
{
ConfigFile = "widgets/Black.conf"
Position = (290,50)
Size = (110,30)
Text = "Refresh"
TextSize = 20
TextColor = (200,200,200)
CallbackID = 2
}
EditBox: "ebpass"
{
ConfigFile = "widgets/Black.conf"
Position = (90,50)
Size = (190,30)
Text = ""
TextSize = 25
MaximumCharacters = 0
Borders = (6,4,6,4)
TextColor = (200,200,200)
SelectedTextColor = (255,255,255)
SelectedTextBackgroundColor = (10,110,255)
SelectionPointColor = (110,110,255)
SelectionPointWidth = 2
CallbackID = 0
}
Button: "btnOnline"
{
ConfigFile = "widgets/Black.conf"
Position = (50,130)
Size = (116,44)
Text = "Online List"
TextSize = 0
TextColor = (200,200,200)
CallbackID = 3
}
}