Home » U++ Library support » TabCtrl » Why does this code hang?
Why does this code hang? [message #45260] |
Sun, 25 October 2015 12:59  |
slashupp
Messages: 231 Registered: July 2009
|
Experienced Member |
|
|
(debian 64-bit)
Based on reply by unodgs: http:// www.ultimatepp.org/forums/index.php?t=msg&th=6809&go to=36746&#msg_36746
The following code hangs when a tab is clicked:
#include <CtrlLib/CtrlLib.h>
#include <TabBar/TabBar.h> //must add package TabBar
using namespace Upp;
struct test_tabbar : public TopWindow
{
typedef test_tabbar CLASSNAME;
TabBar TB;
test_tabbar();
void ontab();
};
test_tabbar::test_tabbar()
{
Title("test_tabbar");
Add(TB);
TB.HSizePosZ(0, 0).VSizePosZ(0, 0);
TB.AddKey("one", "tab one");
TB.AddKey("two", "tab two");
TB.AddKey("three", "tab three");
TB.WhenAction = THISBACK(ontab);
}
void test_tabbar::ontab()
{
PromptOK(TB.Get(TB.GetKey(TB.GetHighlight())).ToString());
}
GUI_APP_MAIN
{
test_tabbar().Run();
}
[Updated on: Sun, 25 October 2015 13:00] Report message to a moderator
|
|
|
|
|
Re: Why does this code hang? [message #45274 is a reply to message #45263] |
Mon, 26 October 2015 18:58   |
omari
Messages: 276 Registered: March 2010
|
Experienced Member |
|
|
try this:
void test_tabbar::ontab()
{
if(TB.FindKey(TB.GetHighlight()) >= 0)
{
PromptOK(TB.Get(TB.GetKey(TB.GetHighlight())).ToString());
}
else
{
PromptOK("key Not found");
}
PromptOK(TB.Get(TB.GetKey(TB.GetCursor())).ToString());
}
regards
omari.
|
|
|
|
|
Goto Forum:
Current Time: Sun May 11 17:40:00 CEST 2025
Total time taken to generate the page: 0.03392 seconds
|