New topic: 

Dynamic control implementation based on platform

<http://forums.realsoftware.com/viewtopic.php?t=26239>

       Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic         Author  
Message       Steve Albin           Post subject: Dynamic control 
implementation based on platformPosted: Thu Jan 29, 2009 12:14 am               
         
Joined: Mon Feb 20, 2006 4:19 pm
Posts: 23
Location: Montclair, NJ              I'm not sure if I can explain well what I 
want to do, but I'll try.

On the Mac, a PopupMenu control cannot get focus so there is no way to use the 
keyboard to select an item.  On Windows, the same PopupMenu control can get 
focus and the keyboard can be used to select items.  

Looking at the ComboBox control, I thought maybe I could use that and use the 
keyboard to select items on both platforms.  Unfortunately, the ComboBox does 
not work on Windows.  Seems the KeyDown event does not respond.

What I would like to do is implement the PopupMenu when compiling for Windows 
and the ComboBox for the Mac.  Is there a way to do this without changing the 
source code for each build?  In other words, handle it using one of the 
conditional compiler statements.  i.e. #if TargetMacOS then...

I realize I could make both controls and turn on visibility based on platform, 
but I need the controls to have the samename so that I can refer to them in 
other places in the window without having to worry about the platform.

Not sure if this makes sense, but any ideas would be appreciated.  If the 
%&#%&%^& ComboBox worked as advertised, I'd be set...   
                            Top                timhare           Post subject: 
Re: Dynamic control implementation based on platformPosted: Thu Jan 29, 2009 
1:00 am                        
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 4262
Location: Portland, OR  USA              Container Controls let you place the 
control at runtime.  The real hinky part is getting the control to be the same 
name.  The compiler must be able to differentiate them.  

You will probably want to wrap the interface to the control(s) in a set of 
methods that will in turn refer to the actual control based on platform.  The 
fact that there are 2 different controls is opaque to the rest of your program. 
 It would even work with 2 controls that you make visible or not, without using 
a container control.  You could make it a class that you pass a reference to 
the 2 actual controls.  That would allow you to reuse the code several times on 
the same window.

Tim   
                            Top               tomis           Post subject: Re: 
Dynamic control implementation based on platformPosted: Thu Jan 29, 2009 2:39 
am                               
Joined: Thu Jul 27, 2006 6:31 pm
Posts: 1321
Location: Monterey, CA              On MacOS X, if the user has full keyboard 
access turn on, then popup menus will be keyboard accessible. See System 
Preferences> Keyboard & Mouse> Keyboard Shortcuts. At the bottom is a radio 
button to allow tabbing to "All Controls"     
_________________
ImagePlay Effects Library (40+ image effects in one open source module. No 
plugins, no dependencies, no restrictions.) 
http://imageplay.sourceforge.net/  
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]     

-- 
Over 900 classes with 18000 functions in one REALbasic plug-in. 
The Monkeybread Software Realbasic Plugin v8.1. 

&lt;http://www.monkeybreadsoftware.de/realbasic/plugins.shtml&gt;

[email protected]

Reply via email to