UI.messagebox "beep"
- 
 There are other series of icons for the messagebox. The default series shows when you use the MB_ type constants: ["MB_OK", "MB_OKCANCEL", "MB_ABORTRETRYIGNORE", "MB_YESNOCANCEL", "MB_YESNO", "MB_RETRYCANCEL", "MB_MULTILINE"]But if add some constant value to these (excluding MB_MULTILINE), you can get a series of messageboxes using different icons. Here are the constants and the icon series you get:  
- 
 Jim, that looks good. Not in the API? 
- 
 @honoluludesktop said: Jim, that looks good. Not in the API? It's there. 
 http://code.google.com/apis/sketchup/docs/ourdoc/ui.html#messageboxBut the return value constant isn't. See the comments at the bottom of the page. 
- 
 The API doesn't mention anything about being able to use a certain icon series by adding a values to the MB constants. I wonder if the return values are still the same in this case? 
- 
 Ah, yea I see now what you mean. Yea - these should be mapped. I had been wishing for such control - similar to what I had in VB and C#. 
- 
 What would probably make it easier to map out was to print out the binary value so we can see which bits are turned on. 
- 
 32.to_s(2) 100000 48.to_s(2) 110000 64.to_s(2) 1000000 80.to_s(2) 1010000 272.to_s(2) 100010000
- 
 How do I "add some constant value" to the following? 
 UI:messagebox "my text "+variable, MB_OK
- 
 Use the bitwise And operator to combine flags: 
 Messagebox with Yes/No button and question mark icon:
 UI.messagebox('Hello World', MB_YESNO | 32)
- 
 WOW 
  
- 
 The Win32 API docs helped: http://msdn.microsoft.com/en-us/library/ms645505%28VS.85%29.aspx Stop: 0x00000010 = 16
 Question:0x00000020 = 32
 Explaination (Yellow Alert Triangle):0x00000030 = 48
 Information (Blue Info Circle):0x00000040 = 64
- 
 [16,32,48,64,80].each { |i| puts i.to_s(2).rjust(8,'0') } 00010000 00100000 00110000 01000000 01010000
- 
 I went thru this a fee months ago or so: It's a Win only thing so far as I know, but I'd like to see what happens on the Mac. Here's a text report of all the integers and the resultant button styles you get. (I believe some of the icons are deprected, specifically the question icon.) 
- 
 @thomthom said: Use the bitwise And operator to combine flags: 
 Messagebox with Yes/No button and question mark icon:
 UI.messagebox('Hello World', MB_YESNO | 32)That's actually the Or operator... but you knew that  Sorry... pedantic mode, off!  @Dan: I've also always wondered what all the obviously-Win32-API-based things did on the Mac version... I always assumed they just translated stuff to the appropriate Mac system-calls/constants, but it would be nice to know for sure. 
- 
 @runnerpack said: @thomthom said: Use the bitwise And operator to combine flags: 
 Messagebox with Yes/No button and question mark icon:
 UI.messagebox('Hello World', MB_YESNO | 32)That's actually the Or operator... but you knew that  Doh!  I swear there's a little brain-gnome that intercepts and swaps words before they reach the hands... I swear there's a little brain-gnome that intercepts and swaps words before they reach the hands...
Advertisement




 
                             
                             
                             
                             
                             
                             
                            