UserArea and EditText
-
Hi,
The title of this topic might be somewhat misleading, or too broad, so bare with me while I try to explain.
I am working on a plugin containing many custom gadgets. Instead of creating aiCustomGui
for each of these I figured out it would be easier to simply create a singleGeUserArea
and handle all drawing, hit testing, selections, etc ...
Main reason for this decision has also to do with the fact that I very much need to support drag and drop. And with only a single userarea to deal with, that would be perfect, as I then do not have to worry when user might accidentally drop an item between the gadgets, in case these would be separate iCustomGuis.
The main problem with this single userarea, however, is that I need a few EditText fields. Right between all the other custom gadgets.As far as I can tell there is no way of "superimposing" an actual EditText gadget onto a GeUserArea.
So far, I have brainstormed three solutions:
- Use a single userarea with a predefined area, in order to draw a dummy EditText box containing the input text. When user clicks in this area a new dialog is shown containing an actual EditText, with OK and Cancel buttons.
- Same as above, but have an EditText located below in the dialog below the userarea. When user selects the predefined area, the focus is set to the EditText below. The "dummy" predefined edittext in the userarea would then be updated as the user edits the EditText input.
- Provide a fully functional edittext area inside the userarea, handling all keyboard inputs, cursor navigation.
Solution 3 is the least desired as this would require quite some work.
I am not too happy about solution 1, as this involves an extra dialog, and requires the user to close this when finished entering text (via OK button, or any other means).
So, obviously, solution 2 seems to be the way to go. But maybe there is/are other solutions(s) I didn't think of? -
Do the GeUserArea sections display anything? Or are they just spacers?
A mock-up picture might help others to visualise.
How about a 'global' drag and drop function? So, make separate iCustomGui/GeUserAreas for each section. Then just point each of these to the same function held in the parent dialog? That way you only have to write the main drag/catch routine once, in the parent dialog.
Just a thought.
WP.
-
Hi,
IMHO solution 2 is not the best because the user has to look below in the dialog to edit the text.
I think solution 1 is the easiest and more convenient, you can simply callc4d.gui.InputDialog()
to get the text.
If you want the input dialog to be shown at the text's location in the user area then you can implement aGeDialog
. -
Thanks to both of you.
I originally thought solution 2 would be the way to go, and have proceeded in that direction ... but the more I look at the result the more I am getting convinced that this wasn't the right approach to deal with the issue.
So, I am still open for solution 1. But will try yet another solution, inspired by the reply from WickedP.I intentionally didn't include a solution where I would create iCustomGui / GeUserArea for each separate gadget. As I thought this would result in drag and drop to only work when hovered over the separate gadgets, and failing when mouse would hover over the space between these gadgets.
But using a global drag and drop function on the dialog itself (instead of all separate gadgets) will actually provide for a complete solution.EDIT:
Set the state of this post to "Solved".
In the end I went for a complete different solution. Not using anyGeUserArea
at all. As such, I could simply position and useEditText
the way it was intended.