Closed rubycoder closed 1 year ago
That's because the latest versions of the Mac (Monterey and Ventura) no longer show the title of a message_box
unfortunately as an intentional simplification of the GUI by Apple (which I don't personally agree with). So, in order to show something in a message_box
, you also need to set the message
property, which was empty in your code (running on Mac Monterey 12.6.2). Windows and Linux on the other hand continue to show the title of a message_box
, as well as older versions of the Mac, like Big Sur and Catalina.
Here is an updated version of your example that will show something on the Mac (added message 'Here is a message!'
):
require 'glimmer-dsl-swt'
include Glimmer
# Display a button that says "Copilot" and when clicked, displays a message box with "Hello, Copilot!"
shell {
text 'Glimmer'
button {
text 'Copilot'
on_widget_selected {
message_box {
text 'Hello, Copilot!'
message 'Here is a message!'
}.open
}
}
}.open
# Path: Glimmer DSL SWT Copilot/button.rb
# Compare this snippet from Glimmer DSL SWT Copilot/samples/hello/hello_button.rb:
You could have found that out for yourself by running samples/hello/hello_message_box.rb
:
require 'glimmer-dsl-swt'
include Glimmer
shell {
text 'Hello, Message Box!'
button {
text 'Please Click To Win a Surprise'
on_widget_selected do
message_box {
text 'Surprise'
message "Congratulations!\n\nYou won $1,000,000!"
}.open
end
}
}.open
Notice how the 'Surprise' title does not show up on Mac Monterey and Ventura.
It's unfortunate that Apple simplified their message boxes as to not display the title anymore. I think a lot of bad things are happening at Apple under Tim Cook without the leadership of Steve Jobs. Tim Cook is no visionary and he's running Apple to the ground. I wish he'd get fired and replaced by a real visionary instead.
In any case, I never personally use Github Copilot (or any kind of generative AI, like ChatGPT), despite all the hype surrounding it (which always seems to be coming from weak or uneducated software engineers). I believe it is a piece of software that has a bug in the requirements. In other words, there was never a need for it from proper well-educated software engineers to begin with, so there was no point in creating it anyways. I could get any answer I need much faster and more accurately at work by pair-programming with another software engineer or simply hitting someone up for help, and it would be a more creative, interesting, and enjoyable social experience that gets me out of my computer bubble. Also, strong software engineers typically find the info they need in APIs and how-to guides more accurately, and they tend to learn libraries they use repeatedly well to the point of knowing answers better than any generative AI. I personally never touch Github Copilot (or anything similar like ChatGPT) with a 10 foot pole. I've observed that code written through A.I. tends to be inferior in general (from seeing A.I. code that some of my coworkers committed to my work project codebase) even if it sometimes works and looks OK from a naive point of view. Relying on A.I. also makes software engineers get weaker, not stronger, at software development. A.I. doesn't have an emotional context of how team members feel about different ways of programming, the general market of hiring software engineers and what skills they have on average, customer feelings and expectations, deadline pressures or lack thereof, and whether some code is good enough for a situation or not. It just outputs one version, and it is often not the best code for the problem at hand. I save time by not wasting any time on A.I. to begin with, and I could always think of code that is better than code added by other developers through A.I., and they end up agreeing with me if I refactor their code.
Just my 2 cents.
In any case, I addressed your concern completely, so I am closing this issue. But, you are welcome to reply still, or even re-open the issue if needed.
Desktop (please complete the following information and make sure it matches Glimmer Pre-Requisites before reporting an issue):
CPU Architecture: Intel Core i5 OS: macOS 12.6.2 Java Version: 18.0.1.1 JRuby Version: jruby-9.3.10.0 Glimmer Libraries/Versions: glimmer-dsl-swt 4.27.0.1
Describe the issue
I logged into GitHub Copilot on RubyMine 2022.3.3, and created a new project. I copied the file ...\glimmer-dsl-swt-4.27.0.1\samples\hello\hello_button.rb into this project and opened it. (My understanding is that this cues Copilot to process this file.) I created a new file, button.rb.
I started typing into button.rb:
require 'g (at this point Copilot suggested) limmer-dsl-swt' (I typed tab to accept this suggestion) (I entered two blank lines. At this point Copilot suggested)
include Glimmer (I typed tab to accept) (I entered the following)
Display a button that says "Copilot" (At this point Copilot suggested) and when clicked, displays a message box with "Hello, Copilot!" (I typed tab to accept)
I didn't keep track of the remaining steps, but I usually would type one token, and it would suggest one or more lines of code. I accepted all of its suggestions. It took me very little typing (or thought) to produce the following code:
The issue I'm seeing is that running the above generated code on macOS 12.6.2 initially displays the correct window, with title "Glimmer" and a "Copilot" button. But clicking the "Copilot" button incorrectly displays a window with a folder icon and an "OK" button:
If I copy this Ruby code to Windows 7 SP 1, it works correctly:
I don't know that the generated code is producing an incorrect result on the Mac. Maybe Copilot generated incorrect code and that code just happens to work on Windows. But I don't see an error in the generated code.
(I'm a Copilot novice. I only used Copilot for about 30 minutes on some simple non-Glimmer Ruby code before doing the above. In this case Copilot saved me a lot of typing, but I could have written similar Glimmer code by simply looking at the hello_button.rb sample. I'm trying to understand how Copilot can or cannot support my Glimmer DSL SWT coding.)