Git Product home page Git Product logo

wxruby3's People

Contributors

andyobtiva avatar dependabot[bot] avatar jminer13 avatar jwillemsen avatar mcorino 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

Watchers

 avatar  avatar  avatar

wxruby3's Issues

Example for SizerFlags is in C++

You are probably already aware of this, but I thought I'd at least mention it in case it's an outlier that slipped through the cracks.

The documentation for Wx::SizerFlags (https://mcorino.github.io/wxRuby3/Wx/SizerFlags.html) is still using C++ for it's example code:

For example, instead of

    sizer->Add(ctrl, 0, wxEXPAND | wxALL, 10);

you can now write

    sizer->Add(ctrl, wxSizerFlags().Expand().Border(wxALL, 10));

Binary Gems for Mac and Linux

Thank you for continuing to maintain the wxRuby3 binding.

Now that the dust settled from my RubyConf 2023 2-Hour Workshop "How To Build Desktop Applications in Ruby", I can start focusing on libraries other than Glimmer DSL for LibUI, which was used in the workshop. One of the biggest weaknesses of the LibUI toolkit is that it is immature as a mid-alpha, thus missing several features for desktop GUI development like support for Tree widget, Image widget, and App Window Icon property. One of the biggest strengths of Glimmer DSL for LibUI is it includes binaries for all platforms of Mac, Windows, and Linux, so people can install the Ruby gem quickly and get started instantly.

If you were to package binaries for Mac and Linux in the wxRuby3 gem, that would make the value proposition of using the mature wxWidgets better in Ruby, removing the trade-off it has with LibUI as far as gem installation time/convenience, and I could continue to add value on top of that with a declarative minimal-syntax highly-productive Ruby DSL in Glimmer DSL for WX.

You can perhaps support binary gems for Mac and Linux in an incremental multi-release approach.

Wx::ListItem missing clear method

Wx::ListItem is missing the clear method:

    info = Wx::ListItem
    info.clear

results in:

accessors.rb:53:in `method_missing': undefined method `clear' for Wx::ListItem:Class (NoMethodError)

Possible missing constant: Wx::FileSelectorPromptStr

Following the documentation (https://mcorino.github.io/wxRuby3/Wx/FilePickerCtrl.html) for the default message parameter, I tried creating the following:

    @filePicker = Wx::FilePickerCtrl.new(static_box_2.get_static_box, Wx::ID_ANY, (''),
      Wx::FileSelectorPromptStr, 'BMP files|*.bmp', Wx::DEFAULT_POSITION,
      Wx::DEFAULT_SIZE, Wx::FLP_USE_TEXTCTRL|Wx::FLP_OPEN|Wx::FLP_FILE_MUST_EXIST)

I then get:

global_const.rb:50:in `const_missing': uninitialized constant Wx::FileSelectorPromptStr (NameError)

I did try the uppercase snake-case version of the constant (Wx::FILE_SELECTOR_PROPT_STR), but that didn't work either.

gem install wxruby3 can't find wxruby3'

Following the directions in the README.md I installed ruby 3.2.2, updated gem to version 3.4.16 and then ran gem install wxruby3 which reported:

ERROR:  Could not find a valid gem 'wxruby3' (>= 0) in any repository
ERROR:  Possible alternatives: fxruby, rx_ruby, swxruby, tx-ruby, wruby, dxruby

I also tried gem install wxRuby3` which took a lot longer but still couldn't find it.

This is running on Windows 11.

Trying to locate problem with using Wx::Choicebook.get_control_sizer

I'm trying to track down a problem with Wx::Choicebook when I use get_control_sizer to add an item. Essentially, my code is this:

    @choicebook = Wx::Choicebook.new(page, Wx::ID_ANY)
    page_sizer.add(@choicebook, Wx::SizerFlags.new.border(Wx::ALL))

    btn = Wx::Button.new(@choicebook, Wx::ID_ANY, 'First')
    @choicebook.get_control_sizer.add(btn,
      Wx::SizerFlags.new.expand.border(Wx::ALL))

If I leave out the btn = and get_control_sizer lines the dialog this is in runs fine, and the main window frame that invoked it also continues to run fine. However, when I include those two lines, the dialog runs fine, but when it closes, ruby crashes with terminated with exit code: 3221226356 which I gather is a heap corruption.

Am I once again doing something obviously wrong?

Also on a related question, I find that breaking into the pry debugger using binding.pry basically locks up even if I remove those two lines. Do you have suggestions for a debugger that would allow breaking into the debugger in a class initialization inherting from a wxWidgets class? I'm trying to find a better way to find which problems are my own code issues before annoying you with a pointless issue...

Feature request: additional constructor for Wx::StaticBoxSizer

The wxRuby3 documentation for Wx::StaticBox shows a variation of initialize that allows passing in a Wx::Window instead of a String for the label parameter. However, Wx::StaticBoxSizer does not have the alternate constructor. When I try the following code in order to get a checkbox as the label for a static box:

    checkPlayAnimation = Wx::CheckBox.new(self, Wx::ID_ANY, 'Play Animation')
    static_box_3 = Wx::StaticBoxSizer.new(Wx::VERTICAL, self, checkPlayAnimation)

I get:

`initialize': Wrong arguments for overloaded method 'wxStaticBoxSizer.new'. (ArgumentError)

My question is, since the underlying Wx::StaticBox already supports a Wx::Window as the label, would it be possible to add another constructor to Wx::StaticBoxSizer which also used a Wx::Window as the third parameter?

Typo in INSTALL.md instruction

gem install wxrbuy3 -- WXWIN=/path/to/wx/install WXXML=/path/to/wx/doxygen/xml

should be

gem install wxruby3 -- WXWIN=/path/to/wx/install WXXML=/path/to/wx/doxygen/xml

Obviously not a big deal, but it's something people will presumably copy and paste only to find it doesn't work without tweaking.

Question about handling GC and same object in Ruby

hi i'm the developer of https://github.com/Hanmac/rwx

Recently i saw a post about your repo on the ruby mailing list so i wanted to check it out.

from the different style to wrap the binding, i myself preferred to write the functions manually so can control the data flow better
I preferred to write C++ code than Swig code.
or some other tweaks like the WX_IDs are Ruby Symbols in my version.

for example how does your version handle the connection between wxWindow and Ruby Window? And also the GC? https://mcorino.github.io/wxRuby3/file.02_lifecycles.html

how do you keep the wxWindow/Ruby object alive?

or when you create a Ruby Window and add it to a wxWindow as a child, how do you keep the reference, that when wxWindow returns your object in as an result of a function, how do you get the right Ruby Window back? the same Instance you created before?

Wx::CalendarCtrl doesn't accept Wx::DefaultDateTime

The documentation for Wx::CalendarCtrl states in the create function that I can use Wx::DefaultDateTime for the date (several other methods on this page also indicate this as the default). However, when I create the code:

    @calendar = Wx::CalendarCtrl.new(self, Wx::ID_ANY, Wx::DefaultDateTime,
      Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::CAL_SHOW_HOLIDAYS)

I get an error from Ruby:

wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt/lib/wx/global_const.rb:47:in `const_missing':
    uninitialized constant Wx::DefaultDateTime (NameError)

It does work if instead I use DateTime.now instead of Wx::DefaultDateTime, but that's not specifically documented. So, I'm not sure if it's a documentation glitch and Wx::DefaultDateTime really isn't supported, or the wxRuby3 implementation is missing the constant.

[Documentation] Windows support, 101 - describing the steps needed to make wxRuby3 work on the windows platform

Hey there mcorino,

Could you show, or link to, instructions how to use wxRuby3 on windows?

This may help people choose between, for instance, libui-ng (and the bindings
kojix2 maintains) and wxRuby3.

Specifically what I would like to suggest this documentation should include
are:

  1. From a vanilla windows machine, say Win10, what do we have to download?
    (I assume ruby, wxRuby3 but also wxwidgets I suppose - perhaps you can
    mention these specifically and where they can be found.)

  2. Once these were all downloaded and installed, how to get towards a
    "hello world" example? That is, which file to specifically invoke to show
    that this all works?

I think that's it.

The reason why I would like to request this is so that we instantly know
that it works on windows; and how to start. Once it all works well,
people can learn things on their own.

I am mostly using Linux myself, but my use case would be to make it
work on windows, because of elderly relatives who use Windows, so
I want to have them use a GUI. Right now my choices are libui-ng,
and java-SWING (via jruby). Adding wxRuby3 to this would be nice to
have. Right now I don't know if this is possible (I also invested too
little time into wxwidgets in general, which is another reason why I
think having this documented is useful; you already mention that it
works on windows, so my request here is more like a request to
extend this information specifically, e. g. "The steps necessary to
make it work on windows").

At any rate, as always, please feel free to go about this request in
any way you see fit, including closing it at any moment in time
at your leisure. Thanks for reading!

Error on Windows trying to set RibbonBar.set_art_provider

I'm getting an error for any value I use for set_art_provider which I suspect is Windows-specific. I have the following code:

    @rbnBar = Wx::RBN::RibbonBar.new(page, Wx::ID_ANY, Wx::DEFAULT_POSITION,
      Wx::DEFAULT_SIZE, Wx::RBN::RIBBON_BAR_SHOW_PAGE_LABELS|
      Wx::RBN::RIBBON_BAR_SHOW_PAGE_ICONS|Wx::RBN::RIBBON_BAR_FLOW_HORIZONTAL)

    @rbnBar.set_art_provider(Wx::RibbonDefaultArtProvider)

What I get is:

 `set_art_provider': Expected argument 1 of type wxRibbonArtProvider *, but got Class
         Wx::RBN::RibbonMSWArtProvider (TypeError)
        in SWIG method 'SetArtProvider'

    @rbnBar.set_art_provider(Wx::RBN::RibbonDefaultArtProvider)

I have tried both variants: Wx::RBN::RibbonAUIArtProvider and Wx::RBN::RibbonMSWArtProvider -- both of them generate an error.

wxGetStockLabel() not ported to wxRuby

It looks like wxGetStockLabel in stockitem.h has not been ported to wxRuby. This function can be helpful for menu items to provide a consistent label and accelerator.

[Documentation] Examples! Feature showcase example, possible entry to FAQ

Hey there mcorino,

I am currently working on a new gem, called "universal_widgets". I have not yet released it;
perhaps today I will.

Andy with his glimmer suite is already years ahead - he also supports wxruby as far as I
am aware. I want to add wxruby3 support for my own gems too, and perhaps one day
bridge into glimmer, e. g. with a full glimmer-spec, perhaps also via jruby + swing and
other java GUIs. Anyway.

Right now I am doing a semi-ok job with regards to gtk, via my gem here:

https://rubygems.org/gems/gtk_paradise

The documentation is, I think, fairly extensive. Not perfect, because at the end I have
kept a LOT of old german documentation too, from 2005 to 2010 and I have not
yet translated it all. Anyway.

I learned a lot via the gtk_paradise gem. I want to do so the same with jruby + SWING
and then also libui (when it supports it) - and then eventually wxruby3. Perhaps you
can also onboard hanmac - he used to maintain the old wxwidget bindings in ruby.
Before he got a job in reallife and then no longer had time for other projects. :P

So, I want to use wxruby3 eventually, via universal_widgets. This shall be the gem I
use for generic widget support in ruby. And perhaps jruby too eventually.

So I want to support wxruby3 eventually.

You already provide plenty of examples here:

https://github.com/mcorino/wxRuby3/tree/master/samples

This is also great - it helps for learning.

ruby-gtk3 has one file called main.rb or demo.rb which features all of GTK3.

Does wxRuby3 also have a "look what is supported"? A single app that showcases
things? If so, could the FAQ mention it? If not, and if you have time and are motivated,
do you think you could have some kind of "meta-app" that can be used to showcase
what wxRuby3 supports? A bit like advertising for wxRuby3 where people can run it
and then perhaps also get curious about it.

What the gtk3 variant also shows is the source code, via a button, so first you open
the app, you start it; and on the right side you can click on a tab and it shows the
code, and you can even modify the code and run it anew. This is kind of cool. If
you can support this that would be great, but time is finite so don't worry if you
lack the time or motivation. It is just a suggestion.

The documentation entry to FAQ would be nice, kind of "this is the first .rb file
you should look at when starting with wxRuby3", and ideally it would be an
app we can use to showcae what wxruby3 is capable of. Kind of like the
feature use case of it, where we can look via our eyes and spot which things
are nifty.

I will eventually get around to testing this subsequently; first I need to add
support for gtk2 again for gtk_paradise (upstream official gtk bindings
no longer support gtk2 by kou, but the FFI bindings by https://github.com/mvz/gir_ffi-gtk
still support it, and I want to support ALL possible GUI toolkits in ruby
eventually, including support for www aka in cgi environments, sinatra,
rails, you name it.)

At any rate thank you for reading and please feel free to close this issue at
any moment in time.

PS: If you feel like it, perhaps when you polished wxRuby3 a bit more, I
would recommend to you to advertise a bit for wxRuby3 on the mailing
list and also help people spread the word and what not, so that more
people know about it. I am pretty certain many folks don't know about
wxRuby3; if you google for ruby wxwidgets or so, the older wxruby
is the number #1 result right now on google search. Or hanmacs
older variant: https://github.com/Hanmac/rwx

So google is lagging behind; your github page here came in third
when I searched for it right now via "ruby wxwidgets"

Docs sometimes refer to Wx::AUI:AuiToolBarItem as Wx::AuiToolBarItem

First off, please indicate if you would prefer I not submit documentation problems at this point. I realize you are currently working on updating the scripts that create them, and I'm trying to limit raising issues to things where it seems at least possible that you might not be aware of it.

In the meantime, I encountered this in the Wx::AUI::AuiToolBarItem docs (https://mcorino.github.io/wxRuby3/Wx/AUI/AuiToolBarItem.html#initialize-instance_method). There are some references in the documentation to Wx::AuiToolBarItem as in:

#initialize(c) ⇒ AuiToolBarItem

Assigns the properties of the Wx::AUI::AuiToolBarItem “c” to this.

Parameters:

    c (Wx::AuiToolBarItem)

This also shows up in the main Wx::AUI::AuiToolBar docs as in:

#add_control(control, label = ('')) ⇒ Wx::AuiToolBarItem
#add_label(toolId, label = (''), width = -1)) ⇒ Wx::AuiToolBarItem
#add_separator ⇒ Wx::AuiToolBarItem

enable_proof_check in a text_ctrl on Windows 11 doesn't do anything

I created a text control with the following code:

    @text_ctrl = Wx::TextCtrl.new(self, Wx::ID_ANY, '', Wx::DEFAULT_POSITION,
      Wx::DEFAULT_SIZE, Wx::TE_RICH2)
    @text_ctrl.enable_proof_check(Wx::TextProofOptions.default)

There are no complaints from Ruby, but when I enter in "tast" and a space, no spell checking is done.

By contrast, if I create the following C++ code:

    text_ctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString,
        wxDefaultPosition, wxDefaultSize, wxTE_RICH2);
    text_ctrl->EnableProofCheck(wxTextProofOptions::Default());

This works as expected -- I get the red squiqly underline under "tast" when I press space after entering in the misspelled word.

This is running on Windows 11.

Unable to create Wx::HyperlinkCtrl

It looks like Wx::HyperlinkCtrl is missing a parent window parameter? When I try to create the control using:

    @hyperlink = Wx::HyperlinkCtrl.new(self, Wx::ID_ANY, 'Hyperlink',
      'https://mcorino.github.io/wxRuby3/Wx/HyperlinkCtrl.html')

I get:

Error initializing #<Wx::HyperlinkCtrl:0x0000022a94a14030 @__swigtype__="_p_wxHyperlinkCtrl"> (NameError)

Correct parameters for Wx::HyperlinkCtrl.new are:
:id => (Wx::StandardID)
:label => (String)
:url => (String)
:pos => (Wx::Point)
:size => (Wx::Size)
:style => (Integer)
:name => (String)

BTW, sorry I didn't get a chance to test these controls a lot earlier. I missed your Beta announcement, and since your first RC announcement, I've been scrambling to add code generation for wxRuby3 to wxUiEditor. Hence issues appearing in mostly alphabetical order as I work down the list of controls to verify valid code generation. Anyway, no rush on finding/fixing these from my perspective -- I'm noting the ones that I'm having problems with, and will check again before I release a beta for wxRuby3 support (which will probably be after you actually release).

Issue with installing wxruby3 on MacOS Ventura on Intel Mac

When I run the command gem install wxruby3 --pre, I get a failure despite having all the prerequisites in INSTALL.md (except for wxWidgets because I assumed it would get compiled from scratch):

 % gem install wxruby3 --pre
Building native extensions. This could take a while...
ERROR:  Error installing wxruby3:
	ERROR: Failed to build gem native extension.

    current directory: ~/.rvm/gems/ruby-3.1.0@glimmer-dsl-wx/gems/wxruby3-0.9.0.pre.rc.2/ext
~/.rvm/rubies/ruby-3.1.0/bin/ruby mkrf_conf_srcgem.rb
Running 'rake  configure'
ERROR: Cannot find wxWidgets. wxRuby requires a wxWidgets >= 3.2.0 release.
Failed to configure wxRuby3
Please make sure you have a valid build environment either by having a system provided wxWidgets 
development package installed (>= 3.2.0) or provide the paths to a locally built and installed 
wxWidgets release (>= 3.2.0) by setting the WXWIN environment variable (and optionally WXXML) 
for the 'gem install' command.
Installed versions of SWIG (>= 3.0.12) and (if no WXXML path is provided) doxygen and git are
also required. 
Checkout the documentation at https://github.com/mcorino/wxRuby3 for more information.

rake failed, exit code 1

Gem files will remain installed in ~/.rvm/gems/ruby-3.1.0@glimmer-dsl-wx/gems/wxruby3-0.9.0.pre.rc.2 for inspection.
Results logged to ~/.rvm/gems/ruby-3.1.0@glimmer-dsl-wx/extensions/x86_64-darwin-22/3.1.0/wxruby3-0.9.0.pre.rc.2/gem_make.out

If I open gem_make.out, I see the same error message above.

I assumed I didn't have to install wxWidgets anywhere because it would get compiled from scratch. If I am wrong, please let me know what to do to fix this issue.

[Documentation] Please consider specifying in the main README clearly which version of wxwidgets are supported

It would be useful to clearly state which versions of wxwidgets are supported.

I'll compile wxWidgets 3.2.2.1 soon and then I will install the latest wxRuby3, but
right now I do not know whether that works. This is why I think it would be very
useful if wxRuby3 could on the main README clearly state which version of
wxwidgets are supported. That way people quickly know whether they should
give the latest wxwidgets a try or stay to some more "stable" variant instead.

Please consider this documentation-request. Thank you for reading.

(PS: If I have missed it perhaps it could be made more prominent, like a
markdown table or something. Right now I do not know if and which
version scheme wxruby3 follows.)

FAQ entry - differences to Hanmac's old wxruby project

Hey there,

I just discovered the project here.

I remember many years ago hanmac wrote some wxruby bindings.

Is this project related to hanmac's work or completely independent?

Also I think some kind of FAQ, on the main README, a separate text
file or the wiki, may be useful. Many people may probably not be
aware that wxruby3 exists. I only found it just accidentally right
now when I looked at the mailing list.

Constructor docs for the Wx::Scrolled variants doesn't show actual ctor name

The documentation for Wx::ScrolledWindow, Wx::ScrolledCanvas and Wx::ScrolledControl all list the constructor as "#initialize ⇒ Wx::Scrolled" rather than the actual constructor (Wx::ScrolledWindow, etc.). I'm not sure if that's by design or just the algorithm getting thrown off by the wxWidgets version of wxScroledl<wxPanel>.

ScaleMode question

I'm in the process of adding code generation support for Wx::GenericStaticBitmap that was added to wxRuby3 0.9.3. Generating bmp.set_scale_mode(Wx::StaticBitmap::ScaleMode.new(1)) works fine for bmp = Wx::GenericStaticBitmap.new(...), but I'm a bit confused by the documentation for Wx::StaticBitmap#set_scale_mode and wondering if I'm doing this right.

The documentation (https://mcorino.github.io/wxRuby3/Wx/StaticBitmap/ScaleMode.html) lists constants such as Scale_Fill -- but if that constant actually exists for wxRuby3, I'm at a loss as to how to use it. I've tried bmp.set_scale_mode(Scale_Fill) and bmp.set_scale_mode(Wx::StaticBitmap::Scale_Fill) niether of which works. Am I overlooking something obvious, or is the only way to implement these constants is to use the ScaleMode with a numical value?

wxWrapSizer not implemented

I'm not sure if this is by design or an oversight, but wxWrapSizer is not implemented. This is a more significant problem for wxUiEditor than the handful of other controls that wxUE supports but wxRuby3 does not. In this case, the user can create multiple children under the sizer, but wxUE cannot generate working Ruby code unless I change the wxWrapSizer they specified into a box sizer which of course won't work the way the user would expect. If it's by design, I'll go ahead and write the generating code to work around it -- but I didn't want to do that unless I knew for sure this wouldn't be in the wxRuby3 1.0 release.

Cannot install [email protected] on MacOS Ventura 13.4.1 with XCode 14.3.1 Command Line Tools

On MacOS Ventura 13.4.1 (2.6GHz 6-Core Intel Core i7) with XCode 14.3.1 Command Line Tools, after I ran the brew tap mcorino/wxruby3 command, when I tried running brew install [email protected], I got an error:

 % brew install [email protected]
==> Fetching dependencies for mcorino/wxruby3/[email protected]: bison and cmake
==> Fetching bison
==> Downloading https://ghcr.io/v2/homebrew/core/bison/manifests/3.8.2
Already downloaded: ~/Library/Caches/Homebrew/downloads/0a84b14c20dfba4609542ea4b14a4eb93d369f7f83f373b568017fc7d76b6505--bison-3.8.2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/bison/blobs/sha256:fc0224d45c74ee561128eb9df366ccb08698b1d659cfb92ea746e57da0108806
Already downloaded: ~/Library/Caches/Homebrew/downloads/0865a0dc7ef4c841a5650a22e6ce05918c025ca1dbadf91d0e18551aca1f4ac3--bison--3.8.2.ventura.bottle.tar.gz
==> Fetching cmake
==> Downloading https://ghcr.io/v2/homebrew/core/cmake/manifests/3.26.4
Already downloaded: ~/Library/Caches/Homebrew/downloads/8ea1edd37726b75365799685b430d0782d649d1482e7f381d6789c28bfeb2e64--cmake-3.26.4.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/cmake/blobs/sha256:7a48fae8706abac0d5c30e88c83bd8eed6fe44e0239ab30d1f20fd74433e5b30
Already downloaded: ~/Library/Caches/Homebrew/downloads/bd367a0f6389b565e23f23b2e4d8ebac4209ba7a34f42f4c15e8a7254cc8d030--cmake--3.26.4.ventura.bottle.tar.gz
==> Fetching mcorino/wxruby3/[email protected]
==> Downloading https://doxygen.nl/files/doxygen-1.9.6.src.tar.gz
Already downloaded: ~/Library/Caches/Homebrew/downloads/76fa517675614cb9416e058c6a9ec3b6679920e8f3a45beb3a66eb71e9c8e37e--doxygen-1.9.6.src.tar.gz
==> Installing [email protected] from mcorino/wxruby3
Error: Your Command Line Tools are too outdated.
Update them from Software Update in System Settings.

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 14.3.

However, I do have XCode 14.3.1 Command Line Tools installed:

Screenshot 2023-07-16 at 7 44 57 PM

One theory I have about the issue is that the [email protected] dependency on XCode is fixed at version 14.3.0 exactly, which is denying 14.3.1 even if it is also compatible. If that is indeed the case and XCode 14.3.1 is actually compatible, maybe you should relax that dependency. That's unless something else is causing this problem.

Wx::BitmapBundle.from_image() is undefined

I'm not sure if this is an issue of the documentation, or a problem with the underlying code. The docs state that Wx::BitmapBundle supports .from_image(). However, the following code:

bundle = Wx::BitmapBundle.new
bundle.from_image(image)

results in a Ruby error:

accessors.rb:53:in `method_missing': undefined method `from_image' for #<Wx::BitmapBundle

By contrast, bundle = Wx::BitmapBundle.new(image) works fine, so I know the problem is not with the image itself (which is a Wx::Image).

Code error messages

Prior to 0.9.0, if you ran ruby from a Windows command prompt, and there was a fatal error caused by an error in the user's ruby code, the error log information would be written to the command prompt window (presumably to stdout or stderr). With 0.9.0, the error information is instead displayed in a dialog box, without the ability to copy the text of the error message. That makes fixing the problem harder, since you cannot see the error message and your code at the same time.

My question is whether there is any way for the user to either a) have that text copy-able, or written to a log file, or b) turned off so that the error text is written to stdout or stderr?

Possible issue with Wx::AUI::AuiNotebook

I'm not sure if this is a problem with my code, or a problem with wxRuby3. I first created a Wx::Notebook with a single page which works fine. I then changed that to a Wx::AUI::AuiNotebook, and added a require 'wx/aui' line. The dialog displays fine, but when I terminate the dialog, Ruby crashes:

 *  Executing task: ruby rb_main.rb 

D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt/lib/wx/core/app.rb:43: [BUG] Segmentation fault
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]

-- Control frame information -----------------------------------------------
c:0006 p:---- s:0024 e:000023 CFUNC  :get_client_area_origin
c:0005 p:---- s:0021 e:000020 CFUNC  :main_loop
c:0004 p:0044 s:0017 e:000016 METHOD D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt/lib/wx/core/app.rb:43
c:0003 p:0029 s:0012 e:000011 METHOD D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt/lib/wx/core/app.rb:59
c:0002 p:0056 s:0006 e:000005 EVAL   rb_main.rb:105 [FINISH]
c:0001 p:0000 s:0003 E:000a90 DUMMY  [FINISH]

-- Ruby level backtrace information ----------------------------------------
rb_main.rb:105:in `<main>'
D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt/lib/wx/core/app.rb:59:in `run'
D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt/lib/wx/core/app.rb:43:in `run'
D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt/lib/wx/core/app.rb:43:in `main_loop'
D:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt/lib/wx/core/app.rb:43:in `get_client_area_origin'

-- C level backtrace information -------------------------------------------
C:\windows\SYSTEM32\ntdll.dll(NtWaitForSingleObject+0x14) [0x00007ffb29a0edd4]
C:\windows\System32\KERNELBASE.dll(WaitForSingleObjectEx+0x8e) [0x00007ffb27143f8e]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_bugreport+0x256) [0x00007fface942ee6]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_bug_for_fatal_signal+0x80) [0x00007fface7405b0]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_shape_memsize+0x542) [0x00007fface88e502]
 [0x00007ff70d1a1e22]
C:\windows\System32\ucrtbase.dll(_C_specific_handler+0xa0) [0x00007ffb26e57f30]
C:\windows\SYSTEM32\ntdll.dll(_chkstk+0x12f) [0x00007ffb29a13dff]
C:\windows\SYSTEM32\ntdll.dll(RtlFindCharInUnicodeString+0xa96) [0x00007ffb2998e456]
C:\windows\SYSTEM32\ntdll.dll(KiUserExceptionDispatcher+0x2e) [0x00007ffb29a12dee]
 [0x000000000000302e]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\lib\wxruby_core.so(Z16GC_mark_wxWindowPv+0x125) [0x00007ffacdbaeea5]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\lib\wxruby_aui.so(Init_wxAuiTabArt+0xac69) [0x00007ffad1be5979]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_gc_verify_internal_consistency+0xaa8) [0x00007fface76e798]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_gc_verify_internal_consistency+0x1a88) [0x00007fface76f778]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_xcalloc_mul_add_mul+0xe6a) [0x00007fface77356a]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_wb_protected_newobj_of+0x7c) [0x00007fface7742bc]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_str_unlocktmp+0x4fc8) [0x00007fface8a6e68]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\lib\wxruby_core.so(Init_wxTopLevelWindow+0x5440) [0x00007ffacd673d00]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_invoke_proc+0x1eb) [0x00007fface92b73b]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_eval_cmd_kw+0x5a3) [0x00007fface930623]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_funcallv+0x11) [0x00007fface930871]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_protect+0x1a4) [0x00007fface74bfe4]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\lib\wxruby_core.so(Z14wxRuby_FuncallRbyyy+0x18a36) [0x00007ffacdbccbd6]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\lib\wxruby_core.so(Z14wxRuby_Funcallyyiz+0x96) [0x00007ffacdbb4046]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\lib\wxruby_core.so(Init_wxTopLevelWindow+0x903e) [0x00007ffacd6778fe]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\ext\wxmsw32u_core_gcc_custom.dll(ZNK20wxTopLevelWindowBase16DoClientToScreenEPiS0_+0x19) [0x00007ffac89d2289]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\ext\wxmsw32u_core_gcc_custom.dll(ZN8wxWindow14InitMouseEventER12wxMouseEventiij+0x10f) [0x00007ffac87b54cf]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\ext\wxmsw32u_core_gcc_custom.dll(ZN8wxWindow16HandleMouseEventEjiij+0x7e) [0x00007ffac87b558e]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\ext\wxmsw32u_core_gcc_custom.dll(ZN8wxWindow15HandleMouseMoveEiij+0x18e) [0x00007ffac87ba35e]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\ext\wxmsw32u_core_gcc_custom.dll(ZN8wxWindow16MSWHandleMessageEPxjyx+0x6b9) [0x00007ffac87c23f9]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\ext\wxmsw32u_core_gcc_custom.dll(ZN8wxWindow13MSWWindowProcEjyx+0x2c) [0x00007ffac87af0bc]
C:\windows\System32\USER32.dll(DispatchMessageW+0x741) [0x00007ffb28c98211]
C:\windows\System32\USER32.dll(DispatchMessageW+0x201) [0x00007ffb28c97cd1]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\ext\wxmsw32u_core_gcc_custom.dll(ZN14wxGUIEventLoop8DispatchEv+0x159) [0x00007ffac87e3409]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\ext\wxbase32u_gcc_custom.dll(ZN17wxEventLoopManual13ProcessEventsEv+0x33) [0x00007ffad5aa56c3]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\ext\wxbase32u_gcc_custom.dll(ZN17wxEventLoopManual5DoRunEv+0x108) [0x00007ffad5aa57e8]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\ext\wxbase32u_gcc_custom.dll(ZN15wxEventLoopBase3RunEv+0x58) [0x00007ffad5aa54a8]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\ext\wxbase32u_gcc_custom.dll(ZN16wxAppConsoleBase8MainLoopEv+0x70) [0x00007ffad5a75820]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\ext\wxbase32u_gcc_custom.dll(Z12wxInitializeRiPPc+0xb1) [0x00007ffad5ae9651]
D:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt\lib\wxruby_core.so(Init_wxGUIEventLoop+0x13f9) [0x00007ffacd5fd8f9]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_error_arity+0x147) [0x00007fface918b27]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_opt_newarray_max+0x3ec) [0x00007fface9344cc]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_exec+0x65c) [0x00007fface925b4c]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_call_end_proc+0x130) [0x00007fface7451f0]
D:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(ruby_run_node+0xa5) [0x00007fface74afd5]
 [0x00007ff70d1a2a20]
 [0x00007ff70d1a12ee]
 [0x00007ff70d1a1406]
C:\windows\System32\KERNEL32.DLL(BaseThreadInitThunk+0x1d) [0x00007ffb27a626ad]

Invoking the dialog is done via:

def on_ruby_test_dlg
  test_dlg = RubyTest.new(self)
  test_dlg.show_modal
  test_dlg.destroy
end

The dialog itself is:

WX_GLOBAL_CONSTANTS = true unless defined? WX_GLOBAL_CONSTANTS

require 'wx/core'
require 'wx/aui'

class RubyTest < Wx::Dialog
  def initialize(parent, id=Wx::ID_ANY, title="Ruby Test Dialog",
        pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE,
        style=Wx::DEFAULT_DIALOG_STYLE)

    super(parent, id, title, pos, size, style)

    dlg_sizer = Wx::BoxSizer.new(Wx::VERTICAL)

    box_sizer_2 = Wx::BoxSizer.new(Wx::HORIZONTAL)

    @notebook = Wx::AUI::AuiNotebook.new(self, Wx::ID_ANY,
      Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::AUI_NB_TOP|
      Wx::AUI_NB_TAB_SPLIT|Wx::AUI_NB_TAB_MOVE|Wx::AUI_NB_SCROLL_BUTTONS|
      Wx::AUI_NB_CLOSE_ON_ACTIVE_TAB|Wx::AUI_NB_MIDDLE_CLICK_CLOSE)
    box_sizer_2.add(@notebook, Wx::SizerFlags.new.border(Wx::ALL))

    page = Wx::Panel.new(@notebook, Wx::ID_ANY, Wx::DEFAULT_POSITION,
      Wx::DEFAULT_SIZE, Wx::TAB_TRAVERSAL)
    @notebook.add_page(page, "page #1")
    page.set_background_colour(Wx::SystemSettings.get_colour(
      Wx::SYS_COLOUR_BTNFACE))

    page_sizer = Wx::BoxSizer.new(Wx::VERTICAL)

    box_sizer = Wx::BoxSizer.new(Wx::HORIZONTAL)

    @static_text = Wx::StaticText.new(page, Wx::ID_ANY,
      "What hath Ruby wrought?")
    box_sizer.add(@static_text, Wx::SizerFlags.new.border(Wx::ALL))

    page_sizer.add(box_sizer, Wx::SizerFlags.new.border(Wx::ALL))
    page.set_sizer_and_fit(page_sizer)

    dlg_sizer.add(box_sizer_2, Wx::SizerFlags.new.border(Wx::ALL))

    set_sizer_and_fit(dlg_sizer)
    centre(Wx::BOTH)
  end
end

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.