How to handle in place text editing in VB.net - vb.net

I have a program that dynamically draws rectangles and then draws the string (name and description) inside the rectangles. My intended behavior is when a user clicks on any of the rectangle, it should show the typing cursor and allow the text to be edited.
What I have tried so far is create a textbox overlay the rectangle the user clicked on. This seems to work ok but I feel as if this isn't the best way to handle it. Does anyone have an alternate solution/idea?

its a bit complicated and maybe not worth it but,
you can listen to user keyboard and when is clicking the rectangle start inputting the text from keyboard to a label (on top of the rectangle)...

Related

how to clip a dynamically created dialog controls

I have a dialog window (MFC, CDialogEx) on which I am displaying some kind of information - mostly text, with some hints about the context (hints made with background color, presence of frames and formatting). Text and everything is written in OnPaint(), using standard CPaintDC dc(this);. Text is long, so everything is scrollable and clipped (with dc.SetClipRgn) to the client area of the dialog (minus some margins). So far, so good, everything works as expected.
On top of that I wanted to add radio buttons that will allow showing cross links between parts of the text (this is kind of a story telling system). No problems with adding them either:
CButton* pCB = new CButton;
pCB->Create(_T(""), WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON | WS_GROUP, cr, this, iButtonNo);
pCB->ShowWindow(SW_SHOW);
(cr is a CReg with button coordinates, iButtonNo is a control ID). Now, when I scroll the dialog I just call SetWindowPos for every radio button to move it together with the text - and it works OK too.
The only thing that I have no idea how to deal with is the radio button clipping. At the moment they are drawn on the whole dialog window. Is there a way to clip the buttons to the same region my text is clipped? I tried to pass the clipping region to the CButton DC (plus some other tricks I could think of) but to no avail.

Label display ignoring form boundaries

Is the following possible and if so, what do I do.
I have multi-line text on a hidden label. When a user clicks a button, the label is displayed under a Textbox (It is re-hidden by a second button click). This works fine. However, if the label text is very long, the label is truncated by the form border(s). Is there a way to "ignore" the form borders as a context menu does? I cannot seem to find a property, or method, to accomplish this. I tried BringToFront but that did not help at all.
I used a label as one project form has 3 labels of this type. Also, I am open to suggestions as to a better way of displaying help then a custom label.

Displaying overlayed QGraphicsItems

I have developed an application in PyQt5 that displays an image and allows the user to pan the image using the mouse and zoom using the mouse wheel. I now need to add the functionality to show popup text associated to specific parts of the displayed image. While painting the text directly on to the QGraphicsScene is a possibility, the range of zooms that are commonly used means that the text will be much too small when zoomed out, or much too large when zoomed in.
I would like to achieve a way of placing the QGraphicsTextItem widgets at a static location that is not affected by the pan and zoom. This way, they can be statically located around the perimiter of the QGrapicsView, and I can draw a line from the text box to the position in the scene. My problem is that I cannot find a way to place the text items so they are independant of the QGraphicsScene. I am thinking that I should have the text items external to the scene, and place the QGraphicsView and any text boxes in a parent QObject. I cannot figure out if this is the best method, and have had limited success with trying to connect a line from QGraphicsElipsesItem that marks the position on the image, to a QLabel in the parent QObject.
I hope I have made this clear enough. Please comment if it needs more clarification.

Want To Create A Floating Speech Bubble Form

Wondering if someone could help me....
I have a small .NET application where I have an Edit button on a main form. When the user clicks the Edit button, I want to popup a small form right next to it (on top of the main form) with a speech balloon tail attached on the side of the form pointing to the Edit button. So it gives the effect of a floating form pushed out from the Edit button.
I don't want the appearance of a normal speech bubble, I want it to look like an actual borderless form (with square corners). It could be a custom control or anything (however, I am not yet familiar with creating my own custom controls), but I need to add Text Controls, Pictures, Label Controls, etc. to this floating form.
Any help would be appreciated.
Thanks
UPDATE
I am trying to create something to this affect:
So imagine the ? being the Edit button and the other being a form with custom controls.
Like this?
To get this behavior:
Select an image which will represent your speech bubble. Put a PictureBox on the form, make it use this image. Place two labels, as above, adjust the font.
Pick your transparency key (color). Your image background and form background need to be set to that. I used black for demo purposes, which is a bad choice if you plan to have any black or text in your speech bubble. Set form's TransparencyKey property to this color in designer. More about TransparencyKey on MSDN.
(final step, not shown on the screenshot). Set FormBorderStyle = None.
Also make sure you have other ways to close your bubble, because X will be unavailable.
The final result may look something like the following:
Note: You may notice some drawing artifacts, most images on the internet have smooth borders, and transparency key does not support shades, has to be exact color. If you are fine with these minor artifacts, feel free to leave it at that. Or, edit it to get rough borders. Or find another one that better suits your needs.

Creating a view for user to fill up a form

I'm creating a view which provides some fields for the user to fill in - address, phone number etc.
I've seen apps that have populated fields with grey text like 'Fill in your name here' on the Name field, and when the user taps on it the text is gone, a keyboard appears and the view is zoomed in to the textfield(or whatever it is). Also, after filling up that field tapping the 'Next' button on the keyboard brings the user to the next field. I'm trying to do the same but I have no idea where to get sources on this. Pardon my poor googling skills ;p
Tried UITextView and UITextField but there isn't anything related to this on the Interface Builder. Figured it lies with the codes?
It'd be great if I can get some explanation or some links on how this works (: Thanks!
EDIT: okay I played around with the Interface Builder a lil more and realized I could set placeholder as the grey text.
It is in fact a UITextField.
You can get the greyed out text by setting its placeholder property.
I am not sure what you mean by zooming but usually they do use a scroll view or adjust the frame so that it isn't blocked by the keyboard.
The Next button is made available using a UIToolbar instance as the text field's inputAccessoryView. However the implementation is one's own and is not framework provided. You can look at this example to get started.