You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Weekend? I started with one two months ago and still haven't got all
done. Okay, so I haven't had a lot of time to work with it either,
but still, code is now up to 160KB, and growing..
When you start from scratch, you also discover how much there really
is behind a "simple", standard edit control. It's very educational..
The edit control gives you alot of stuff for free already. If you want
to minimize the extra code, then subclass the control. The messages
you want i.e. Tab & Enter Notifications can be generated by you simply
by Message forwarding to your parent window. I just can't see this path
to be a messy one.
Regards,
Jules
Leave a comment:
Guest replied
Now the wind has changed, got to do a little tacking to sail
into the wind. Sounds like the hard way to do it, but hey
that's what makes the challenge SO MUCH fun.
1. Set up a wndclass for the class name to use.
2. Assign the wndproc for the class, OBTW a custom one
for your particular situation. Don't forget to call the default
proc for unprocessed messages.
3. Register your class.
4. Call CreateWindow() API function.
That's it, minus a whole lot of coding for the class def and
wndproc. Don't forget those nasty WM_NOTIFY messages you'll
need to send to the parent of the edit control.
Good Luck,
Cecil
------------------
Leave a comment:
Guest replied
Thanks Cecil,
But what I want to do is build my own custom edit box control. That way I can make it do what I want without having to twist and contort the windows controls.
You might need to add a few more styles for
scrollbars or whatever if I understand!
Cheers,
Cecil
------------------
Leave a comment:
Guest replied
Hey guys,
Thanks for the pointers. I thought long and hard over subclassing but it seems very messy and If i'm going through the trouble of doing that much work than I might as well just write one myself. I don't need anything fancy just a multiline edit that can scroll over the text. I really dont mind forcing a maximum string length. These edit boxes will be used to enter text that resides inside a structure so fixed length strings works out great. Thanks again guys!
It does sound like you may want to investigate Instance Subclassing (or possibly even superclassing).
Essentially, Instance Subclassing lets you modify the behavior of a given control to suit your own needs.
With Instance Subclassing, you "intercept" messages for a particular control, thereby giving you a chance to process messages before the control's own handler gets them. You can even swallow messages too.
For the case you mentioned above, you would look for relevent %WM_CHAR messages, and either forward the message to the parent's callback, or send you own customized message to the parent.
Most of the good Win32 programming books cover subclassing.
Basically speaking, an editor is nothing but an ownerdrawn window
that uses a parser and TextOut to print the text to the screen.
Simple, until you start doing one from scratch yourself. Then you
discover how much code there really is behind the editor scene. The
textbox probably is one of the most complicated controls of them all.
Scroolbars, code to handle keyboard input, mouse and caret movements,
text buffers, fast parsers, undo/redo memory buffers. Different kinds
of painting procedures, depending on if text is selected ot not, etc.
Good place to start is by looking at the translated Petzold samples
available in PB's file area. There's one called "Typer there, in
Chapter 5, which can serve as a base for your own edit control.
There are also some samples of custom control editors in the source
code forum that can be helpful to look at.
Does anyone know how or what API functions are called to get an edit box to display multiline text. What is happening when you scroll over the text? The reason I'm asking is because I want to make my own edit box that passes TABS,ENTER,etc.. back to the controls owner. Any ideas on how to start this little adventure?
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: