Hi all,

I want to make my own widgets in c++, but don't know where to start. I didn't find any
examples, tutorials,... on google. I know there are some toolkits like qt, gtk+, wxwidgets, and i've used them already, but i want to make some myself. Qt says to use the widgets that are available on the platform, so i have to write my code for every platform specific, that's not a problem.

Any ideas where to start?

regards, hannesvdc

Recommended Answers

All 5 Replies

You will first have to figure out what your widget needs to do then program it using very low-level GUI functions, on *nix using something like X11R6 or MS-Windows use win32 api graphics functions. This is not an easy task and not for the unexperienced. On MS-Windows it isn't as difficult as on *nix because you can write your own ActiveX control that contains all the code for the new widget. Using VC++ 2010 Pro you can create an ActiveX control is a matter of just a few clicks of the mouse, the compiler will generate all the startup code for you.

I agree with Ancient Dragon that its fairly easy to do in Win32 (who would want to disagree with Ancient Dragon anyway?)

I call these things 'Custom Controls'. That is perhaps why you can't find any links to this. The term 'widget' is a somewhat 'nix centric expression. In Windows we call them custom controls or ActiveX controls. I have a tutorial here on creating them...

http://www.jose.it-berater.org/smfforum/index.php?topic=2907.0

However, it is in PowerBASIC. Further, however, it is pure Win32. If you understand Win32 you can easily translate it to C. If you don't know Win32 you're dead in the water, unfortunately.

ActiveX controls can be 'cookbooked' with MFC or Atl. However, I tend to write them from scratch using pure Win32. That isn't a casual endeavor, however. If you want, I'll translate thattutorial to C++. You'll have to let me know though.

Thanks for fast reply,

I can use the windows API to make my gui in windows, but what to do on other platforms?

Also thanks for the tutorial, i'll have a look at that, translation to c++ isn't necessary.

hannesvdc

I imagine you need to learn how to do it with one of the cross-platform toolkits then. Otherwise, you would need a specific and different implementation for each platform. Win32 is out in that case. You need a higher level abstraction layer on which to work.

I've quite a bit experience with the big toolkits(like qt, wxwidgets,win32 libs,...), and that is the reason i want to try it myself. Thanks for telling me that i have to do it for each platform specific, i didn't know that.
Are there other things i should know about?

hannesvdc

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.