Using Visual C++ MFC.
I have a dialog page, which contains a tab control object. I've created my own tab control class derived from CTabCtrl, where I created all my tab pages contained in an array, like so:
tabArray[0] = new TabPage;
tabArray[1] = new TabPage;
tabArray[0]->Create(DIALOG, this);
tabArray[1]->Create(DIALOG, this);
In my initial dialog page, I have a bunch of checkboxes. Depending on the state of these checkboxes, I add/remove the tab pages (but not the underlying TabPage classes!).
This is done like so. I keep track of which tabs are enabled/disabled in m_fTabEnabled. The state of the tab is toggled with the checkbox. This is used to determine which tab needs to be inserted.
m_fTabEnabled[iTab] = !m_fTabEnabled[iTab];
DeleteAllItems();
for(int i = 0; i < NUMOFTABS; ++i)
{
if(m_fTabEnabled[i]) InsertItem(i, m_sTabNames[i]);
}
Using this method, I have an issue that if I have three tabs enabled, and I remove the second tab, that the dialog containing the data from the second tab is displayed on the third tab. For example:
tab 1, label 1, contains: 1
tab 2, label 2, contains: 2
tab 3, label 3, contains: 3
remove tab 2, tab 3 is shifted to tab 2
tab 1, label 1, contains: 1
tab 2, label 3, contains: 2
tab 3 hidden.
This causes a problem when I'm retrieving data from the tabs, because what I filled in tab three is lost to the data that used to be in tab two.
Does anybody have any suggestions on ways to manage this?
Related
regarding combit List & Label Version 24, Designer
I want specific objects on specific layers and these on specific pages.
I use page breaks on the objects saying "break before ..." and I want the layers connected to specific pages like this:
Layer 1, Page = 1
Layer 2, Page = 2
Layer 3, Page = 3
Layer 4, Page = 4
Layer 5, Page = 5
... but I do not get any working result with it.
With these "page = number" expression I do not get any result.
For now I have 3 pages and organized it like this:
Layer 1 = Page() = 1
Layer 2 = Page() >= 1
Layer 3 = Page() > 1
The result shows 3 pages and the second object (that is connected to layer 2) shows up on page 2 and 3.
Is there any simple solution to make it happen that every object is connected to one layer and that one layer to only one page?
Thank you very much in advance.
Problem solved.
Somehow it now works. After checking the Barcode example demo it works.
The page connections to the layers work fine with
Page() = <number>
On previous tries it did not …
Anyway, all fine now.
I have a shiny Application which has a navigation List to the Left , I am having issues with the User Interface file in which i try to change the Navigation list to tabsets , But the below code does it for all the entire tabs that are present in shiny , But i want to choose a specific side tab in this case "Word Network " and want plot1 and plot 2 coded below should be shown only in this navigation and not other .
navlistPanel(
tabPanel("Introduction",
fluidRow(h3("Introduction",align="center"),tags$img(src="TextAnalytics.jpg",height=300,width=600),align="center"),
value=11,verbatimTextOutput("introduction")),
#tags$img(src="TextAnalytics.jpg",height=800,width=800),
tabPanel("Upload the File",fileInput("data1",label=("Upload the Unstructured Textual data To be analysed"))),
tabPanel("structure",value=1,verbatimTextOutput("str")),
tabPanel("data",value=2,tableOutput("data")),
tabPanel("Summary",value=3,verbatimTextOutput("summary")),
tabPanel("Word Cloud",value=4,plotOutput("plot",width=1000,height=600)),
tabPanel("Sentiment Analysis",value=5,plotOutput("plot2",width=1000,height=600)),
tabPanel("Topic Modelling",value=6,plotOutput("plot3",width=1000,height=600)),
#tabPanel("Word Frequency",value=7,plotOutput("plot4",width=1000,height=800)),
tabsetPanel(
tabPanel("plot1",value = 11),
tabPanel("plot2",value = 11)
),
tabPanel("Hierarchial Clustering",value=8,plotOutput("graph1",width=1500,height=h)),
tabPanel("Correlation Analysis",value=9,plotOutput("corelation",width=1000,height=1000)),
tabPanel("Word Network",value=10,plotOutput("graph2",width=1000,height=600)),
tabPanel("Community Detection",value=12,plotOutput("democommunity",width=1000,height=600)),
id="tabselected"
)
)
I have created a GUI with the aid of Tkinter that has created a 3 [C]olomn by 8 [R]ow, (I have placed the borders of the 'cells' in red) and output is like so:
Just to calrify:
Where the "logo [E]" is (C1,R1) & (C1,R2) are rowspanned and where the "main window" is from (C2,R3) to (C3,R8) are colomnspanned and rowspanned.
All are Label widget except for (C1,R3 to C1,R8), which are button widgets with a command to display a string in "Main Window" (gray area).
My aim is to make the "Main Window"(gray area) display only in different grid layouts based on the selected button on the left. So for example I would like to make the grey have a grid layout of 2col by 4 row when C1,R6 is pressed, or when C1,R3 is pressed the grid layout to be 2Cx6R all in the gray area.
Q: Is there a way of re-gridding a label? If so how? Or an alternative approach?
ADDENDUM:
Ideally I would like to update the GREEN area with different number of row and column configurations. For example: When Micro Audit is touched, the Green area will configure itself to have 4 rows by 2 columns, and when Find Item is selected, it will only 3 rows with 1 column, etc. :
I have three widgets under my main window . I design my program that each widget will be controlled by a class .
Last 2 hours I waste my time to fit 3 GUI elements to one of this widgets.
I want to have a label and a line item and a button. I put them in to a grid layout(in real case I have 3 row for simplicity I put 1 row in the example below). And set the grid layout's parent to my class.
What I expect is this GUI items to resize themselves and fit to one row in this widget, no matter what I tried I couldn't succeed .
In short I expect this items to shrink to fit to the widget by themselves. But couldn't figure out how to do it. Any advice ?
void
enviromentSetup::createDialogs()
{
numberOfPoints = new QLabel (QApplication::translate("leftPanel","numberOfPoints"));
inputNumberOfPoints = new
QLineEdit(QString::number(st_environmentParamaters.number_of_points_in_line));
maxElementsButton = new QPushButton("Max Elems");
gridLayout = new QGridLayout(this);
gridLayout->addWidget(numberOfPoints, 0, 0);
gridLayout->addWidget(inputNumberOfPoints, 0, 1);
gridLayout->addWidget(maxElementsButton, 0, 2);
this->show();
}
It is insufficient to merely make the parent of the layout the main widget. You also have to explicitly set the layout of the widget.
Add the following line just before you show the widget:
this->setLayout(gridLayout);
I'm still getting used to the sizers in wxWidgets, and as such can't seem to make them do what I want.
I want a large panel that will contain a list of other panels/boxes, which each then contain a set of text fields
----------------------
| label text box |
| label2 text box2 |
----------------------
----------------------
| label text box |
| label2 text box2 |
----------------------
----------------------
| label text box |
| label2 text box2 |
----------------------
I also need to be able to add (at the end), and remove(anywhere) these boxes.
If there's too many to fit in the containing panel a vertical scroll bar is also required.
This is what I've tried so far, it works for the first box that's created with the containing panel, but additional added items are just a small box in the top left of the main panel, even though the sizer code is the same for all boxes.
//itemsList is a container containg a list of *Item pointers to each box/panel/whatever the right name is
Items::Items(wxWindow *parent)
:wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
{
//one sstarting item
OnAdd(wxCommandEvent());
}
void Items::OnAdd(wxCommandEvent &event)
{
unsigned id = itemsList .size();
Item *item = new Item(this,id);
itemsList .push_back(item);
RebuildSizer();
}
void Items::RebuildSizer()
{
this->SetSizer(0,true);
wxBoxSizer *sizerV = new wxBoxSizer(wxVERTICAL);
for(std::vector<Item*>::iterator it = itemsList .begin(); it != itemsList .end(); ++it)
sizerV->Add(*it, 1, wxEXPAND | wxLEFT | wxRIGHT, 5);
SetSizer(sizerV);
}
void Items::OnRemove (wxCommandEvent &event, unsigned itemId)
{
delete itemsList [itemId];
itemsList .erase(items.begin()+itemId);
for(std::vector<Item*>::iterator it = itemsList .begin()+itemId; it != itemsList .end(); ++it)
(*it)->ChangeId(itemId++);
RebuildSizer();
}
Also what's the best way to lay out the contents of each box? I was thinking of using a 2 by 2 grid sizer but I'm not sure how to make the text boxes to expand to be as wide as possible while making the labels stay as small as possible (but also maintaining the alignment between the 2 text boxes)?
"If theres too many to fit in the containing panel a vertical scroll bar is also required."
You could have a look at wxScrolledWindow.
"additional added items are just a small box in the top left of the main panel"
I am not sure, but, maybe a call to wxSizer::Layout() will help.
"Also whats the best way to lay out the contents of each box?"
Have a look at this sizerdemo. If it is not mandatory, that the labels stay as small as possible, you could give the labels a fixed width and only let the text boxes grow. If you want to adapt the size when adding or removing new boxes, you could implement the OnSize() event handler.
May I suggest to you to post this question to one of the wxWidgets mailing list? They will be able to help you very quickly.
Can I also recommend the wxForum, I have found it very useful for wxWidgets questions in the past.
More specifically for scrolling wxScrolledWindow should help, use wxScrolledWindow->SetSizer with your top level sizer (the one that contains your controls) to set up a scrolled area, also check out the samples called scroll, scrollsub and vscroll included in wxWidgets (in the samples directory of your wxwidgets install).