[RESOLVED] MDI forms and textboxes on child forms not editable
I'm very much a newcomer to MDI forms, and I found a method posted here which worked fine. In every form in my program I added the setparent part of the code and all forms load into it fine, but that's where the weirdness begins.
Firstly, if I set a form as an MDI child (as I assume I need to) the form's width/height is set weirdly...but I would assume I could fix that on form_load so haven't worried too much about it for now (plus I don't think I really need to set it as a child as it's an internal form and seems to work fine without being set)
Secondly, textboxes which have worked fine in the past as single non-MDI forms (with the forms not set as child) but once they're added into the MDI form (or any form, MDI or otherwise) they're not editable...I can click but it doesn't highlight the text within, and I can't type anything into them. MOST of what the program does actually doesn't require any typing, but I would nevertheless like to know how to fix it as some parts do need to be typed into :lol:
Has anyone any suggestions about either of these issues? :sick:
Re: MDI forms and textboxes on child forms not editable
In the vast majority of cases you shouldn't be using SetParent for your own forms, you should simply set the MDIChild property - they will then load into the MDI parent, and should behave normally.
You should never use both methods together, as they will conflict badly.
Is there a reason you aren't just setting the MDIChild property?
Re: MDI forms and textboxes on child forms not editable
No reason really, I'm fairly new to MDI (as I said above) and you know what an amateur programmer I am from experience :-)
However, I'm now not using the MDIchild, and I will try as you said above (doing the opposite to what I have done) and see how it goes...and will reply to this when I've tested it
Re: MDI forms and textboxes on child forms not editable
Update: It seems to work fine and you've sorted the most important problem for me (and gained the reputation for it, of course...or would have if VBF would let me give you more :-))...but any idea about the child form resizing itself? In design time it's correctly laid out but it jumps in size
In design
w4695 h1830
When running on MDI form
w15690 h6990
The settings have also changed from width/height to scalewidth/scaleheight...might have something to do with it, they were just width/height when they were normal forms (although other forms which used the setparent but not mdichild are all fine size-wise)
Re: MDI forms and textboxes on child forms not editable
The size shouldn't change unless you have code to do that.
The only thing that springs to mind is the BorderStyle property - try a different value, particularly if you are currently using 'None'.
Quote:
The settings have also changed from width/height to scalewidth/scaleheight...might have something to do with it, they were just width/height when they were normal forms (although other forms which used the setparent but not mdichild are all fine size-wise)
I'm afraid I have no idea what you mean... forms have all 4 of those properties whether they are Child or not.
Re: MDI forms and textboxes on child forms not editable
If the form is sizeable it jumps in size, if it's fixed it doesn't...and if it is sizeable I have to set it to size on load (and none are marked as "none")...but all is fixed now so I'll mark this resolved, thanks!