How do you create a textbox in visual Studio with c#? - visual-studio-2010

I feel kind of silly asking this question as it seems really simple, but how do I create a text box that I can type in instructions and stuff like that. I don't need the user to be able to change it, it is just to give instructions. I tried the label, but it only allows one line. I need something that can allow about a paragraph or so. Similar to the box in an installer that describes what the program does. What did I miss?

You can use a label but set its AutoSize property to false. This allows you to size the label as you wish and it will automatically wrap the text to fit.
You can also anchor the label to the parent form to have it automatically resize and reflow the text if the user resizes the parent form.

You want a text box, but set its Read Only property to TRUE, and maybe Enabled to FALSE

Related

JavaFX: Cross-Platform Button Resizing Issue [duplicate]

If I make button relatively small, it's caption turns to ellipsis.
How to turn off this feature?
Don't let the button go below it's preferred size, then it will never need to elide the text of the button label:
button.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE);
I want to make very small button
You can use any of the below either separately or in combination:
Apply CSS to use a very small font in the button.
Make the label text for the button very short.
Use brian's answer which proposes explicitly setting the ellipse string to empty.
Use a small graphic icon instead of text.
You can use setMinSize as documented above in all cases (if you wish the button not to go below a preferred size truncating or eliding content).
In all cases, if you wish, you can also apply CSS to minimize the padding between the label and button the border.
From your previous comment (I want to use simple captions like "<" and ">"), I think option 2 (Make the label text for the button very short) is what you want.
You may also be interested in Joel's Designing for People Who Have Better Things To Do With Their Lives which would indicate, usability-wise that very small buttons are usually a pretty bad idea.
in your label/button you can use the textOverrun property to turn off ellipsis.
textOverrun.set(OverrunStyle.CLIP);
this is probably a bit late for you, so i am putting it here for lone wanderers digging up this question.
It puts ... because there's no room for the text. You can use bigger buttons or a smaller font but if you really want the dots gone use button.setEllipsisString(""); , but then you just get truncated text.

Changing window layout in gtk2hs

I am making an applocation to demonstrate some algorithms, and I am using gtk2hs. When the user selects an algorithm, I want the whole window to change (different layout, input, output interface...). How could I do that? For example, is it possible to change the widget in a container? I tried a table but could not changed the content of a cell, so that doesn't seem like a good idea.
Also I want to change the number of input fields according to another input field, and that seems like the same problem for me (removing widgets from a box) but it might be totally different in terms of solution.
Thanks
How to change the content of a box, can you delete a widget from it? If yes, how?
Use widgetDestroy. See for example this tutorial.

Why won't my windows form Data repeater Resize?

After searching for a few days, i thought maby someone can help me.
I'm making a Windows form Application. And on one of my views i have a repeater with a label in there. This label is dynamicly sized. But My DataRepeater item won't adjust to the size of my label.
Has anyone a idea how to fix this?
The datarepeater i use is from the visual basic powerpacks.
If any more Infromation is needed to help me, please let me know.
Regards Stephan
It looks like DataRepeater is very limited with regards to resizing. I found this website that it looks like they got it working, but all of the items resize to the same size.
http://social.msdn.microsoft.com/forums/en-US/vbpowerpacks/thread/c93579f2-8b4c-4002-9ce2-152e2dddd10e/
Edit:
This solution is a little bit more complex, but VERY flexible:
You can use a FlowLayoutPanel:
You create an User Control for the item on the list and add a Select Property to the User Control.
You add a list of the User Controls to the FlowLayoutPanel.
When the User Control change size, it automatically adjust everything in the FlowLayoutPanel. (Disable WrapContents to prevent Horizontal Scrolling)
http://msdn.microsoft.com/en-us/library/ms171633.aspx
You can use the following in the UserControl to enable Click on the User Control to select it:
Click event for .Net (Windows Forms) user control
In the form that use the FlowLayoutPanel, you add the Click event, and then apply the Select to only that one User Control.
You can use the SetBoundsControl inside the User Control to set the size of the item.

How do I edit a cell in an MFC Listbox?

I have a CListCtrl control that has 2 columns and any number of rows. I want the user to be able to click(or maybe double-click) a "cell" and be able edit the text therein.
What I mean is that I want to be able to click and edit any of the places where it says "TEST" by clicking on the text to make it editable.
How should I go about this? I suppose I should use a mouse click event but how would I make the cell editable?
This looks like a list control in report mode, which is different from a list box. A list box doesn't support editing contents at all. You can write code entirely on your own to get the contents of a line, copy that to an edit control, display the edit control exactly where the existing content was shown, allow the user to edit, and copy data back when/if the user hits return.
A list control allows editing of one (and only one) field. If you want to support more, you have a couple of choices. One would be about like above, creating your own edit control in the right place. The obvious alternative would be to look up one of the many grid controls. CodeProject has a number of variations.

Custom editor in QAbstractTableModel

Does anyone have an example of using a QWidget as an editor in a QAbstractTableModel?
I have a column which when edited should create a QCombobox with the list of choices.
The docs seem to suggest I need to write a QAbstractItemDelegate and a custom paint function but that seems overkill to simply pop-up a standard QCombobox in Qt::EditRole.
Note - the combo box contents are the same for every row and it only needs to be shown when somebody clicks in the cell.
I know this should be simple but I can't get it to work. It's easy for a QTableWidget based table - but I need it for a very large data table.
The docs seem to suggest I need to write a QAbstractItemDelegate and a custom paint function but that seems overkill to simply pop-up a standard QCombobox in Qt::EditRole.
You don't need to go that far. One way is to subclass QStyledItemDelegate and then override createEditor() so that it returns your prepopulated combo box. Its setEditorData and setModelData functions will probably already suffice if you`re using basic Qt value types.
If you need something more generic that works across many different models, you can create a QItemEditorFactory that associates your editor with the correct type. This also works well with custom types.
When indicated by your view's EditTrigger, your view will get the delegate specific to the cell on which the edit is being invoked and call delegate->createEditor(...) which can then size the combo box according to the options parameter as well as set the current entry to the value specified by the model, although most of this should be handled by the QStyledItemDelegate. Thus, you won't have to worry about the Qt::EditRole directly as the view will handle that.
Did you try and have a look at the following example from Qt :
Spin Box Delegate Example
Maybe it will give you a much clearer view on the subject !
Hope it helps a bit !

Resources