Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example:
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Main/Raffle
This example is the version from Sat, 5th May 2017.
Project "Raffle.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub Open()
me.ColumnType(0) = me.TypeCheckbox
End EventHandler
End Control
Control Out Inherits Canvas
ControlInstance Out Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect)
if started then
dim t as string
g.TextFont = "Marker Felt"
if UBound(names)>=0 then
g.ForeColor = &c777777
t = names.pop
else
g.ForeColor = &c000000
t = List.Cell(haken,0)
List.CellCheck(haken,0) = true
PushButton1.Enabled = true
end if
dim parts() as string = split(t," ")
dim size,w0,w1 as integer
for n as integer = 300 downto 1
g.TextSize = n
w0 = g.StringWidth(parts(0))
if UBound(parts)>0 then
w1 = g.StringWidth(parts(1))
end if
if w0<g.Width and w1<g.Width then
size = n
exit
end if
next
g.DrawString parts(0), (g.width-w0)/2, g.Height/2-size/2, g.Width
if UBound(parts)>0 then
g.DrawString parts(1), (g.width-w1)/2, g.Height/2+size/2, g.Width
end if
end if
End EventHandler
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
dim u as integer = List.ListCount-1
redim names(-1)
for i as integer = 0 to u
names.Append List.Cell(i,0)
next
started = true
me.Enabled = false
for i as integer = 1 to 10
dim k as integer = rnd * List.ListCount
if List.CellCheck(k,0) then
// ignore
else
haken = k
out.Invalidate
timer1.Mode = 2
Return
end if
next
me.Enabled = true
End EventHandler
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action()
out.Invalidate
End EventHandler
End Control
EventHandler Sub Open()
me.Maximize
End EventHandler
Note "Note"
This is our raffle app for Real Studio events :-)
Enjoy it
Property Haken As Integer
Property Names() As string
Property started As Boolean
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 Main Plugin.