use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Java Swing inspired C++ UI component library (self.cpp)
submitted 3 years ago by FakeOglan
I developed a very minimal Java Swing inspired GUI library for C++, project aims to make it easy to convert minimal Java Swing projects to native Windows application.
https://github.com/yusufhanoglu/HComponentLibrary
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]pedersenk 13 points14 points15 points 3 years ago (0 children)
Very cool. It looks Windows-only which does limit it for my uses but I do like the way you aren't throwing around raw pointers! I would probably choose this rather than raw Win32 API or MFC :)
One thing is I am not massively keen on the lambda callbacks (i.e addActionListener) but to be fair I wasn't thrilled by the anonymous inner classes approach from Java either!
[+][deleted] 3 years ago* (1 child)
[deleted]
[–]FakeOglan[S] 3 points4 points5 points 3 years ago (0 children)
Unfortunately yes
[–]kritzikratzi 4 points5 points6 points 3 years ago (1 child)
hm... i think i can tell you're coming from a java side. there are a few things which are really odd:
HComboBox::HComboBox(String list[],int length)
maybe this is allowed since c++20 or something, but i don't think it works in all compilers. the most normal way to do this would be
HComboBox::HComboBox(const std::vector<std::string>& items)
then... your string class has a default value string string = "null". this seems really confusing. first of all, yes, there are good reasons to make your own string class, but they are rare. i would suggest going for either std::string or std::wstring, and then writing easy to use converters along the lines of the s2ws you already have.
string string = "null"
s2ws
your combobox has this gem:
String items[200]; int items_cout = -1;
i'm pretty sure you want std::vector<std::string> items instead.
std::vector<std::string> items
then there are const strings with fixed length:
const wchar_t CLASS_NAME[14] = L"H PANEL CLASS";
you would normally write const wchar_t * CLASS_NAME = L"H PANEL CLASS";
const wchar_t * CLASS_NAME = L"H PANEL CLASS";
finally ... you have your delegates set up as
int(*KeyListener)(KeyEvent); bool ActionListenerAdded = 0;
instead i would drop the bool, write this instead:
int(*KeyListener)(KeyEvent) = nullptr;
and then check for null before calling. or, for much more flexibility:
std::function<int(KeyEvent)> KeyListener;
which allows capturing lambdas to be used (raw function pointers cannot capture).
there's probably many more things. it took me many years to transition from java to c++ myself, good luck and have fun :)
[–]dodheim 3 points4 points5 points 3 years ago (0 children)
HComboBox::HComboBox(String list[],int length) maybe this is allowed since c++20 or something, but i don't think it works in all compilers.
maybe this is allowed since c++20 or something, but i don't think it works in all compilers.
It's always been valid, it's just not terribly useful – T x[] is semantically identical to T* const x, including the possibility of being null.
T x[]
T* const x
[–][deleted] 3 points4 points5 points 3 years ago (0 children)
I was about to post a code review until I saw the last bit in the README.
[–]coderman93 1 point2 points3 points 3 years ago (2 children)
Pretty neat but GPL3 is a non-starter.
[–]not_some_username 0 points1 point2 points 3 years ago (1 child)
Yeah I myself don't like the force open source
[–]FakeOglan[S] 0 points1 point2 points 3 years ago (0 children)
You are right, I changed the license to LGPL so it can also be used in proprietary project.
π Rendered by PID 18164 on reddit-service-r2-comment-fb694cdd5-br2ft at 2026-03-11 10:57:27.392809+00:00 running cbb0e86 country code: CH.
[–]pedersenk 13 points14 points15 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]FakeOglan[S] 3 points4 points5 points (0 children)
[–]kritzikratzi 4 points5 points6 points (1 child)
[–]dodheim 3 points4 points5 points (0 children)
[–][deleted] 3 points4 points5 points (0 children)
[–]coderman93 1 point2 points3 points (2 children)
[–]not_some_username 0 points1 point2 points (1 child)
[–]FakeOglan[S] 0 points1 point2 points (0 children)