New topic: 

tool button Menu action

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

       Page 1 of 1
   [ 4 posts ]                 Previous topic | Next topic         Author  
Message       crazymacsoftware.com           Post subject: tool button Menu 
actionPosted: Tue Oct 13, 2009 5:38 pm                               
Joined: Sat Jun 20, 2009 7:08 pm
Posts: 70              Hi,
I am using this code to put tool items in my toolbar.
How do I make the speak text toolbar item have a menu with two options 
and what do I do to get those to menu item options to do something?

Here's what I am doing to create the toolbar and menu items
so far the menus aren't showing up

Code:
dim SelectAllButton as ToolButton
dim SoundButton as ToolButton

SelectAllButton = New ToolButton
SoundButton = New ToolButton

SelectAllButton.Caption = "Select All"
SelectAllButton.Name = "Select All"
SelectAllButton.icon = SelectAllIcon

SelectAllButton.Style=ToolButton.ToolStylePushButton

Me.append SelectAllButton

Dim SpeakMenu as New MenuItem
Dim StartSpeaking as New MenuItem
Dim StopSpeaking as New MenuItem

SoundButton.Name = "Speak Text"
SpeakMenu.text = "Speak Text"

StartSpeaking.text = "Start Speaking..."
StopSpeaking.text = "Stop Speaking..."

SpeakMenu.append StartSpeaking
SpeakMenu.append StopSpeaking

SoundButton.caption = "Speak Text"
SoundButton.name = "Speak Text"
SoundButton.icon = SoundIcon

SoundButton.Style=ToolButton.ToolStyleDropDown



I got this in the dropdownmenuaction
Code:
Select Case hititem.text
Case "Start Speaking..."
  speak (readerwnd.bookarea.text)
Case "Stop Speaking..."
  speak (" ",True)
End Select



and this in the action event..
Code:
Select Case item.name
Case "Select All"
  readerwnd.bookarea.selectAll
Case "Read Text"
  beep
End Select

Me.append SoundButton


  
  But it isn't working

  Can someone show me what I am doing wrong?

  Brian   
                            Top                timhare           Post subject: 
Re: tool button Menu actionPosted: Tue Oct 13, 2009 6:36 pm                     
   
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 6555
Location: Portland, OR  USA              In your first block of code (from 
toolbar Open?) shouldn't you have

me.Append SoundButton

at the bottom of the code?   
                            Top               crazymacsoftware.com           
Post subject: Re: tool button Menu actionPosted: Tue Oct 13, 2009 6:42 pm       
                        
Joined: Sat Jun 20, 2009 7:08 pm
Posts: 70              Yeah I just put that in there it puts a icon in the 
toolbar 
but there is no attached menu? Am I missing something?

Brian     
_________________
----
Brian Heibert
[email protected]  
                            Top                timhare           Post subject: 
Re: tool button Menu actionPosted: Tue Oct 13, 2009 7:05 pm                     
   
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 6555
Location: Portland, OR  USA              How about

SoundButton.DropDownMenu = SpeakMenu

Tim   
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 4 posts ]     
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to