GithubHelp home page GithubHelp logo

gammasoft71 / examples_wxwidgets Goto Github PK

View Code? Open in Web Editor NEW
154.0 154.0 32.0 5.01 MB

Shows how to use wxWidgets controls only by programming code (c++17).

Home Page: https://gammasoft71.wixsite.com/gammasoft/wxwidgets

License: MIT License

CMake 21.21% C++ 78.79%
checkbox controls cpp cpp17 example examples linux macos messagebox modern-cpp multi-platform progressbar radio-buttons sample samples tabcontrol textbox trackbar windows wxwidgets

examples_wxwidgets's Introduction

Gammasoft

Gammasoft aims to make c++ fun again.

About

  • Gammasoft is the nickname of Yves Fiumefreddo.
  • More than thirty years of passion for high technology especially in development (c++, c#, objective-c, ...).
  • Object-oriented programming is more than a mindset.
  • more info

Main projects

Project Brief
xtd Modern C++17/20 framework to create console, GUI and unit tests applications on Windows, macOS, Linux, iOS and android.
xtd_c C11 framework to create console, GUI and unit tests applications on Windows, macOS, Linux, iOS and android.
tunit Modern C++17 unit testing framework on Windows, macOS, Linux, iOS and android.
delegates Modern C++17 library containing multicast delegate and event classes on Windows, macOS, Linux, iOS and android.
properties another C#-like property accessor for C++11 and above on Windows, macOS, Linux, iOS and android.
examples shows how to use gui controls with some common toolkits.

gammasoft_img github_img github_img facebook_img twitter_img discord_img mail_img

examples_wxwidgets's People

Contributors

danishbelal avatar ericfont avatar gammasoft71 avatar hiteshhedwig avatar onddleo avatar orbitcowboy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

examples_wxwidgets's Issues

Low Resolution examples under macOS

I only tested OpenGL example, but by default it provides very low resolution on Retina display.

Something like this needs to be added to CMake to fix it:

add_custom_target(NSPrincipalClass ALL plutil -replace NSPrincipalClass -string NSApplication ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents/Info.plist DEPENDS ${PROJECT_NAME})
add_custom_target(NSHighResolutionCapable ALL plutil -replace NSHighResolutionCapable -bool true ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents/Info.plist DEPENDS ${PROJECT_NAME})

CMake Error

CMake Deprecation Warning at src/Controls/StaticText/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

WX version: wxwidgets-gtk3-3.2.2.1-2
CMake version: cmake-3.27.1-1

i can fix it by changing cmake version but for others i left it here

Some tips to help compile in Windows

Hi, my system is:

Windows 7 x64
wxWidgets 3.1.4 (build=release shared=0 monolithic=0)
GCC MinGW 10.2.0
Visual Studio 2017
cmake 3.18.1

I just wanted to know if my wxWidgets compile is good so I downloaded this project and compiled with VS 2017 and GCC

With VS2017

Configuring with cmake it was a PITA, because you have to either create environmente variables or just pass the variables to cmake to configure wxWidgets, here are the variables, the importants are: wxWidgets_ROOT_DIR, wxWidgets_LIB_DIR, wxWidgets_CONFIGURATION, but after creating those variables cmake was complaining about the variable: wxWidgets_LIBRARIES, and the docs says that this variable will be setted by cmake, don't know why was complaining sure I did something wrong but I don't know, at the end just either create environment variables or just pass the variables to cmake, I created all env vars and just:

cmake -G "Visual Studio 15 2017 Win64" ..

Not tested all projects but the ApplicationAndMain ApplicationAndMain2 gives undefined reference to main, this happens because VS uses its own main function for GUIs that is WinMain, the only way to solve this is to change subsystem to console but this shows the console window, even using the FreeConsole() function to hide the window it still appears for less than 2 seconds

With MinGW GCC

I also have GCC 7.1 and it is my default compiler but this version does not fully support C++17 so I had to configure cmake to select the GCC 10.2 like this:

set mingw64_path=c:/mingw-w64/x86_64-10.2.0-posix-seh/mingw64/bin

set CC=%mingw64_path%/gcc.exe
set CPP=%mingw64_path%/g++.exe
set MAKE=%mingw64_path%/mingw32-make.exe
set RC=%mingw64_path%/windres.exe

cmake -DCMAKE_MAKE_PROGRAM=%MAKE% -DCMAKE_C_COMPILER=%CC% -DCMAKE_CXX_COMPILER=%CPP% -DCMAKE_RC_COMPILER=%RC% -DCMAKE_VERBOSE_MAKEFILE=ON -G "MinGW Makefiles" ..

This generated the Makefiles with no problems

Also there was undefined reference to many functions with the RichTextCtrl project , after digging in internet I found that the libs should be in a specific order and since there are many libs I found this and I changed the file link.txt this part:

... --minor-image-version,0, @CMakeFiles\RichTextCtrl.dir\linklibs.rsp

to

... --minor-image-version,0,--start-group @CMakeFiles\RichTextCtrl.dir\linklibs.rsp

and that solved the libs and the project compiled fine

cmake

Now some tips to get better experience with both MSVC compiler and GCC

  • Check if wxWidgets_ROOT_DIR, wxWidgets_LIB_DIR:PATH, wxWidgets_CONFIGURATION vars are set if not show a message that these vars must be set
  • Check for minimun compiler version to run C++17 I think GCC is 7 or 8, dont know about MSVC
  • Detect wxWidgets compilation options like static (passing -DwxWidgets_USE_STATIC:BOOL=ON) in GCC add -static option and MSVC add option /MT for release and /MTd for debug (passing -DwxWidgets_USE_DEBUG:BOOL=ON) here more info
  • Add to the linker the --start-group to solves the libs order

wxEVT_LEFT_UP mouseEvent not triggering in the webview sample

Hi!

I've added in the WebFrame::WebFrame constructor in the webview sample:

https://github.com/wxWidgets/wxWidgets/blob/WX_3_0_BRANCH/samples/webview/webview.cpp

the following event binding:

panel->Bind(wxEVT_LEFT_UP, [&](wxMouseEvent& event) {
    wxMessageBox(wxString::Format("The frame is clicked at {x=%d, y=%d}", event.GetPosition().x, event.GetPosition().y), "FrameClick", wxID_ANY) ;
    std::cout << event.GetPosition().x << " , " << event.GetPosition().y << std::endl;
    mouse_position = event.GetPosition();
});

But I do not get any output

What am I doing wrong? How to make it work?

PS: I know my question is not stictly related to this github's repo, but, may be, you can give me some helpful hints

build on Debian 11 for CommonControls/ActivityIndicator fails "fatal error: wx/activityindicator.h: No such file or directory"

e@debian-desktop:~/Examples_wxWidgets/build$ cmake ..
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_baseu-3.0;-lwx_gtk3u_core-3.0;-lwx_gtk3u_html-3.0;-lwx_baseu_xml-3.0;-lwx_gtk3u_richtext-3.0 (found version "3.0.5") 
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_gtk3u_xrc-3.0;-lwx_gtk3u_html-3.0;-lwx_gtk3u_qa-3.0;-lwx_gtk3u_adv-3.0;-lwx_gtk3u_core-3.0;-lwx_baseu_xml-3.0;-lwx_baseu_net-3.0;-lwx_baseu-3.0 (found version "3.0.5") 
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_baseu-3.0;-lwx_gtk3u_core-3.0;-lwx_gtk3u_aui-3.0 (found version "3.0.5") 
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_gtk3u_xrc-3.0;-lwx_gtk3u_html-3.0;-lwx_gtk3u_qa-3.0;-lwx_gtk3u_adv-3.0;-lwx_gtk3u_core-3.0;-lwx_baseu_xml-3.0;-lwx_baseu_net-3.0;-lwx_baseu-3.0 (found version "3.0.5") 
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_baseu-3.0;-lwx_gtk3u_core-3.0;-lwx_gtk3u_html-3.0;-lwx_baseu_xml-3.0;-lwx_gtk3u_richtext-3.0 (found version "3.0.5") 
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_gtk3u_xrc-3.0;-lwx_gtk3u_html-3.0;-lwx_gtk3u_qa-3.0;-lwx_gtk3u_adv-3.0;-lwx_gtk3u_core-3.0;-lwx_baseu_xml-3.0;-lwx_baseu_net-3.0;-lwx_baseu-3.0 (found version "3.0.5") 
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_baseu-3.0;-lwx_gtk3u_core-3.0;-lwx_gtk3u_gl-3.0 (found version "3.0.5") 
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_gtk3u_xrc-3.0;-lwx_gtk3u_html-3.0;-lwx_gtk3u_qa-3.0;-lwx_gtk3u_adv-3.0;-lwx_gtk3u_core-3.0;-lwx_baseu_xml-3.0;-lwx_baseu_net-3.0;-lwx_baseu-3.0 (found version "3.0.5") 
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_baseu-3.0;-lwx_gtk3u_core-3.0;-lwx_gtk3u_html-3.0;-lwx_gtk3u_richtext-3.0;-lwx_baseu_xml-3.0 (found version "3.0.5") 
-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_gtk3u_xrc-3.0;-lwx_gtk3u_html-3.0;-lwx_gtk3u_qa-3.0;-lwx_gtk3u_adv-3.0;-lwx_gtk3u_core-3.0;-lwx_baseu_xml-3.0;-lwx_baseu_net-3.0;-lwx_baseu-3.0 (found version "3.0.5") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/e/Examples_wxWidgets/build
e@debian-desktop:~/Examples_wxWidgets/build$ cmake --build . --config Debug
Scanning dependencies of target HelloWorldEmoticons
[  0%] Building CXX object src/HelloWorlds/HelloWorldEmoticons/CMakeFiles/HelloWorldEmoticons.dir/HelloWorldEmoticons.cpp.o
[  0%] Linking CXX executable HelloWorldEmoticons
[  0%] Built target HelloWorldEmoticons
Scanning dependencies of target HelloWorldGenericStaticText
[  1%] Building CXX object src/HelloWorlds/HelloWorldGenericStaticText/CMakeFiles/HelloWorldGenericStaticText.dir/HelloWorldGenericStaticText.cpp.o
[  1%] Linking CXX executable HelloWorldGenericStaticText
[  1%] Built target HelloWorldGenericStaticText
Scanning dependencies of target HelloWorldMessageDialog
[  1%] Building CXX object src/HelloWorlds/HelloWorldMessageDialog/CMakeFiles/HelloWorldMessageDialog.dir/HelloWorldMessageDialog.cpp.o
[  2%] Linking CXX executable HelloWorldMessageDialog
[  2%] Built target HelloWorldMessageDialog
Scanning dependencies of target HelloWorldMessageDialog2
[  2%] Building CXX object src/HelloWorlds/HelloWorldMessageDialog2/CMakeFiles/HelloWorldMessageDialog2.dir/HelloWorldMessageDialog2.cpp.o
[  2%] Linking CXX executable HelloWorldMessageDialog2
[  2%] Built target HelloWorldMessageDialog2
Scanning dependencies of target HelloWorldPaint
[  3%] Building CXX object src/HelloWorlds/HelloWorldPaint/CMakeFiles/HelloWorldPaint.dir/HelloWorldPaint.cpp.o
[  3%] Linking CXX executable HelloWorldPaint
[  3%] Built target HelloWorldPaint
Scanning dependencies of target HelloWorldSay
[  4%] Building CXX object src/HelloWorlds/HelloWorldSay/CMakeFiles/HelloWorldSay.dir/HelloWorldSay.cpp.o
[  4%] Linking CXX executable HelloWorldSay
[  4%] Built target HelloWorldSay
Scanning dependencies of target HelloWorldStaticText
[  4%] Building CXX object src/HelloWorlds/HelloWorldStaticText/CMakeFiles/HelloWorldStaticText.dir/HelloWorldStaticText.cpp.o
[  5%] Linking CXX executable HelloWorldStaticText
[  5%] Built target HelloWorldStaticText
Scanning dependencies of target wxWidgetsHelloWorld
[  5%] Building CXX object src/HelloWorlds/wxWidgetsHelloWorld/CMakeFiles/wxWidgetsHelloWorld.dir/wxWidgetsHelloWorld.cpp.o
[  6%] Linking CXX executable wxWidgetsHelloWorld
[  6%] Built target wxWidgetsHelloWorld
Scanning dependencies of target Application
[  6%] Building CXX object src/Applications/Application/CMakeFiles/Application.dir/Application.cpp.o
[  6%] Linking CXX executable Application
[  6%] Built target Application
Scanning dependencies of target ApplicationAndAssert
[  7%] Building CXX object src/Applications/ApplicationAndAssert/CMakeFiles/ApplicationAndAssert.dir/ApplicationAndAssert.cpp.o
[  7%] Linking CXX executable ApplicationAndAssert
[  7%] Built target ApplicationAndAssert
Scanning dependencies of target ApplicationAndException
[  7%] Building CXX object src/Applications/ApplicationAndException/CMakeFiles/ApplicationAndException.dir/ApplicationAndException.cpp.o
[  8%] Linking CXX executable ApplicationAndException
[  8%] Built target ApplicationAndException
Scanning dependencies of target ApplicationAndMain
[  8%] Building CXX object src/Applications/ApplicationAndMain/CMakeFiles/ApplicationAndMain.dir/ApplicationAndMain.cpp.o
[  8%] Linking CXX executable ApplicationAndMain
[  8%] Built target ApplicationAndMain
Scanning dependencies of target ApplicationAndMain2
[  9%] Building CXX object src/Applications/ApplicationAndMain2/CMakeFiles/ApplicationAndMain2.dir/ApplicationAndMain2.cpp.o
[  9%] Linking CXX executable ApplicationAndMain2
[  9%] Built target ApplicationAndMain2
Scanning dependencies of target ApplicationIcon
[  9%] Building CXX object src/Applications/ApplicationIcon/CMakeFiles/ApplicationIcon.dir/ApplicationIcon.cpp.o
[ 10%] Linking CXX executable ApplicationIcon
[ 10%] Built target ApplicationIcon
Scanning dependencies of target ActivityIndicator
[ 11%] Building CXX object src/CommonControls/ActivityIndicator/CMakeFiles/ActivityIndicator.dir/ActivityIndicator.cpp.o
/home/e/Examples_wxWidgets/src/CommonControls/ActivityIndicator/ActivityIndicator.cpp:4:10: fatal error: wx/activityindicator.h: No such file or directory
    4 | #include <wx/activityindicator.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

ApplicationIcon example does not properly load icon on linux

"Failed to load image from file "Resources/Gammasoft.png"
2021-09-15_19-29

This happens if I run the ApplicationIcon example from anywhere except:

~/Examples_wxWidgets/src/Applications/ApplicationIcon

In which case I invoke execution with this relative path:

../../../build/src/Applications/ApplicationIcon/ApplicationIcon

because at least there the png is under the Resources directory.

HelloWorldPaint not showing the expected text

HelloWorldPaint not showing the expected text draw as it is hidden by the panel, commenting out the panel will make the text "the drawing " shows directly on the wxFrame (I tested it using Visual Studio 2019).

private:
//wxPanel* panel = new wxPanel(this);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.