Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Picture Plugin, MBS MacCG Plugin, MBS MacCF Plugin, MBS MacOSX Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacOSX/Input Sources
This example is the version from Tue, 21th Jan 2019.
Project "Input Sources.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
test1
test2
End EventHandler
Sub Fill(w as window1, a() as TextInputSourceMBS)
dim list as listbox = w.List
for each t as TextInputSourceMBS in a
dim s,e as string
if t.IsEnabled then
e = "yes"
else
e = "no"
end if
if t.IsSelected then
s = "yes"
else
s = "no"
end if
dim c as string
Select case t.Category
case t.kTISCategoryInkInputSource
c = "Ink"
case t.kTISCategoryKeyboardInputSource
c = "Keyboard"
case t.kTISCategoryPaletteInputSource
c = "Palette"
else // unknown
c = t.Category
end Select
dim lang as string = join(t.SourceLanguages, ", ")
list.AddRow "", t.LocalizedName, c, e, s, lang
dim icon as IconMBS = t.Icon
if icon<>Nil then
// icon object
dim p as new Picture(16,16,32)
dim b as CGBitmapContextMBS = CGBitmapContextMBS.CreateWithPicture(p)
icon.DrawIconCGContext(b.Handle, 0, 0, p.Width, p.Height, 0, 0, 0, &cFFFFFF)
list.RowPicture(list.LastIndex) = p
else
// icon file
dim f as FolderItem = t.IconImageFile
if f<>Nil then
dim p as Picture = Picture.Open(f)
if p<>Nil then
list.RowPicture(list.LastIndex) = p
end if
end if
end if
next
End Sub
Sub test1()
dim a() as TextInputSourceMBS = TextInputSourceMBS.CreateASCIICapableInputSourceList
dim w as new window1
w.Title = "Input List"
fill w, a
End Sub
Sub test2()
dim a() as TextInputSourceMBS = TextInputSourceMBS.CreateInputSourceList(nil, true)
dim w as new window1
w.Title = "All"
fill w, a
End Sub
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project
The items on this page are in the following plugins: MBS MacOSX Plugin.