Created
January 27, 2018 12:32
-
-
Save anaselli/5a9d5e013b71fe2cff2908bcaafd696e to your computer and use it in GitHub Desktop.
Changing an YtableCell does not work as expected and looses a coulmn entry (Gtk and ncurses)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ -I/usr/include/yui -lyui test-YtableCell.cc -o test-YtableCell | |
#include <sstream> | |
#include "YUI.h" | |
#include "YApplication.h" | |
#include "YWidgetFactory.h" | |
#include "YDialog.h" | |
#include "YLayoutBox.h" | |
#include "YEvent.h" | |
#include "YTable.h" | |
#include "YTableHeader.h" | |
#include "YCheckBoxFrame.h" | |
#include "YWidget.h" | |
#include "YTimeField.h" | |
#include "YAlignment.h" | |
#define LAYOUT_HELPER_CONVENIENCE( AL ) \ | |
inline YWidget * at##AL ( YWidget * w ) { return YUI::widgetFactory()->create##AL( w ); } | |
LAYOUT_HELPER_CONVENIENCE( Left ); | |
LAYOUT_HELPER_CONVENIENCE( Right ); | |
LAYOUT_HELPER_CONVENIENCE( Top ); | |
LAYOUT_HELPER_CONVENIENCE( Bottom ); | |
LAYOUT_HELPER_CONVENIENCE( HCenter ); | |
LAYOUT_HELPER_CONVENIENCE( VCenter ); | |
LAYOUT_HELPER_CONVENIENCE( HVCenter ); | |
int main( int argc, char **argv ) | |
{ | |
YDialog * dialog = YUI::widgetFactory()->createPopupDialog(); | |
YLayoutBox * vbox = YUI::widgetFactory()->createVBox( dialog ); | |
YAlignment * minSize = YUI::widgetFactory()->createMinSize( vbox, 40, 8 ); // minWidth, minHeight | |
YUI::widgetFactory()->createLabel ( vbox, "YTable test" ); | |
YTableItem *pItem; | |
YTableHeader* head = new YTableHeader; | |
head->addColumn( "Right", YAlignEnd ); | |
head->addColumn( "Center", YAlignCenter ); | |
head->addColumn( "Left", YAlignBegin ); | |
head->addColumn( "Notes", YAlignBegin ); | |
YTable* table = YUI::widgetFactory()->createTable( atLeft(minSize), head ); | |
table->setNotify( true ); | |
YItemCollection items; | |
items.push_back( new YTableItem( "a", "b", "c", "extra" ) ); | |
items.push_back( new YTableItem( "aa", "bb", "cc" ) ); | |
pItem = new YTableItem( "aaa", "bbb", "ccc", "" ); | |
items.push_back( pItem); | |
items.push_back( new YTableItem( "aaaa", "bbbb", "cccc" ) ); | |
items.push_back( new YTableItem( "aaaaa", "bbbbb", "ccccc" ) ); | |
items.push_back( new YTableItem( "aaaaaa", "bbbbbb", "cccccc" ) ); | |
table->addItems( items ); | |
YUI::widgetFactory()->createPushButton( vbox, "&OK" ); | |
// press OK to add a note int Notes cell (third line) | |
// BUG: that is added int Left column instead | |
dialog->waitForEvent(); | |
int cellNum = pItem->cellCount(); | |
YTableCell* pCell = pItem->cell(cellNum-1); | |
pCell->setLabel("Added later into Notes"); | |
table->cellChanged(pCell); | |
dialog->waitForEvent(); | |
dialog->destroy(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment