venussc
asked on
Puting an image inside an edit box
I would like to insert a small picture <icon> inside an edit box to give a nicer edit box and indicate the function of the edit box. I have attached a picture that represent this. Can anyone kindly provide code to that this.
I have tried setting the edit box as a parent to a timage but that doesn't work.
Note that typing inside the textbox starts just where the image ends i.e. typing doesn't occur above the image.
Thanks.
picinsideeditbox.JPG
I have tried setting the edit box as a parent to a timage but that doesn't work.
Note that typing inside the textbox starts just where the image ends i.e. typing doesn't occur above the image.
Thanks.
picinsideeditbox.JPG
Might be easier to not use TEdit and use something else to do it instead like Richedit and insert the image then the text, either that or overlay an edit box, kinda messy.
ASKER
Any other suggestions Please?
You will need a custom component. This discusion show a couple of ways to do it.
https://www.experts-exchange.com/questions/10200599/TEdit-with-Canvas.html
https://www.experts-exchange.com/questions/10200599/TEdit-with-Canvas.html
ASKER
Thanks for the link!! Will have a look at it and give feedback later!
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
There is a bug in this TEditEx component.
Here is how to reproduce the bug:
- Create a TEditEx object in a form
- Load that small picture (16x16 pixels)
- Then click the edit area so it get focused
- Type a long text until the text scrolled inside the edit area
- Now, use mouse ... point to the right-most side of the edit area
- press and hold the left mouse (so the text will be selected if you move the mouse)
- then move the mouse to the far far left
You will see that the small image will be sort of cleared ...
Here is how to reproduce the bug:
- Create a TEditEx object in a form
- Load that small picture (16x16 pixels)
- Then click the edit area so it get focused
- Type a long text until the text scrolled inside the edit area
- Now, use mouse ... point to the right-most side of the edit area
- press and hold the left mouse (so the text will be selected if you move the mouse)
- then move the mouse to the far far left
You will see that the small image will be sort of cleared ...