Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/CGS/CGS Windows
Function:
Required plugins for this example: MBS MacCG Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCG/CGS/CGS Windows
This example is the version from Sun, 17th Mar 2012.
Project "CGS Windows.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() if CheckBox1.Value then showprocesslist false else showlist c.GetWindowList end if End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() if CheckBox1.Value then showprocesslist true else showlist c.GetOnScreenWindowList end if End EventHandler
End Control
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
End Control
EventHandler Sub Open() c=new CGSConnectionMBS if c.Handle=0 then MsgBox "CGS is not available. Requires Mac OS X 10.4 or newer." end if End EventHandler
Sub showlist(l as cgswindowlistMBS) dim i,c as integer dim w as CGSWindowMBS dim name as string dim p as new ProcessMBS List.DeleteAllRows if l=nil then Return p.GetCurrentProcess name=p.Name c=l.Count-1 for i=0 to c w=l.Item(i) if w<>Nil then List.AddRow str(w.Handle) List.Cell(List.LastIndex,1)=w.Title List.cell(List.LastIndex,2)=name List.cell(List.LastIndex,3)=str(w.Left) List.cell(List.LastIndex,4)=str(w.top) List.cell(List.LastIndex,5)=str(w.width) List.cell(List.LastIndex,6)=str(w.height) List.cell(List.LastIndex,7)=str(w.alpha) end if next End Sub
Sub showprocesslist(onscreen as boolean) dim i,c as integer dim w as CGSWindowMBS dim p as new ProcessMBS dim name as string dim l as CGSWindowListMBS List.DeleteAllRows p.GetFirstProcess do name=p.Name if onscreen then l=self.c.GetOnScreenWindowListForProcess(p.ProcessID) else l=self.c.GetWindowListForProcess(p.ProcessID) end if if l<>Nil then c=l.Count-1 for i=0 to c w=l.Item(i) if w<>Nil then List.AddRow str(w.Handle) List.Cell(List.LastIndex,1)=w.Title List.Cell(List.LastIndex,2)=name List.cell(List.LastIndex,3)=str(w.Left) List.cell(List.LastIndex,4)=str(w.top) List.cell(List.LastIndex,5)=str(w.width) List.cell(List.LastIndex,6)=str(w.height) List.cell(List.LastIndex,7)=str(w.alpha) end if next end if loop until not p.GetNextProcess End Sub
Property c As cgsconnectionMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS MacCG Plugin.




Links
MBS Xojo PDF Plugins