Hello
Has anybody ever written an edit control. I am looking into how I would go about this. I know when I get WM_KEYDOWN I would add that letter to the buffer depending on where the carrot is but there is still some things I'm not sure about. Dose an edit control have to draw its own carrot (I think thats what its called the place where new text apears) or is there an api function to do this. If anyone has any source code of this that would be good also
thanx
Posted on 2001-12-20 21:42:00 by Quatum
I know it's not well documented, and worse that it's not fully compatible to masm, but the code is easy to read. Check for the fasm asmwork's asmedit.dll source. You can download it from fasm homepage.

I tried to write one and stopped after a while, but unless you have a very good need for it, you'd better take the windows edit, richedit or another already made control and add to it's functionnality.

Or perhaps you're like me and want to reinvent the wheel everytime to make a better version...
Posted on 2001-12-20 21:51:16 by Silas
I very reciently got hot headed and decided to build my own Edit control... Didnt get too far before reality set in :)

But after that evenings progress (hehehe), I did manage to figure out the framework needed... I stopped at the actually dirty work of Making the CONTROL (framework) into an EDIT control.

I will upload the flamework in a day or two (got my last exam today, and gotta go drinking tonight! )...

Long story short tho, its quite simple. Fillin an new WNDCLASSEX structure, register it, point this SECOND structure to a new "control proc", and then use CreateWindow with the current window as the parent. The new proc is you control proc. Place all you need in there to make the window work as an EDIT control. (( You may want to set some special window styles etc to get the title bar gone)).

I got a small example working, but the "control" is not an EDIT control, rather a scrolling marque control, that scrolls text by from right to left. (( It was alot simpler than all the headaches an EDIT control will have ))

Anywho... Nag me if i forget...

NaN
Posted on 2001-12-21 04:05:53 by NaN
there's an example of this in july 2001 msdn. look up the DrawText function, then scroll to the bottom. there's a link there that says "Displaying Keyboard Input."

it's in c, but shouldn't be too hard to convert.
Posted on 2001-12-21 12:51:40 by Sloat
Quatum,
The complexity of an edit control depends on the kind of functionality you want to give it. An edit control like the one used in notepad with only fixed-pitch fonts should not be too much of a problem. But designing something like richedit or VC++ style editor would take a long,long time.
I was writing one few months ago for my IDE ,it was working quite well ,but i got bogged down due to the no of features i had to provide , so i decided to use a ready-made control. I will probably complete it for the secnd version :)
Unless you want to do so for educating yourself or for creating something you really need you shouldnt go into creating a custom edit control.
I dont think any sources exist in asm except Fasm and sPasm sources. Most are in C++.
So if C++ is your baby, then you shouldnt have too many problems finding one. :)
Otherwise, there is little to look forward. I can help you but you have to decide what you want.

As for the caret, you can have your own or you can use the caret functions. Look for them in the API reference.
Posted on 2001-12-21 21:53:19 by MovingFulcrum