QT Class mainWindow

 

Overview

The RAD mainWindow class is the principal tool for AIS Lisp to surface a graphic user interface (GUI). Opening and showing the mainWindow object causes the AIS Lisp .exe to move from the Background Processes list to the Apps list in the Windows Task Manager. The mainWindow is one of the key words accepted by the qt function. There can be only one mainWindow object.

Instantiating and showing the mainWindow object paints a GUI background containing

The functions surfaced with the mainWindow object allow the AIS Lisp programmer to manage the various features and services available via the mainWindow object.

 

Title Bar

The Title Bar appears along the top of the application main window GUI and contains the .exe icon followed by whatever contents are specified by the AIS Lisp programmer.

 

Horizontal Menu Bar

The Horizontal Menu Bar appears along the top of the application main window GUI just below the Title Bar. It contains the drop down menus specified by the AIS Lisp programmer.

 

Horizontal Tab Bar

The Horizontal Tab Bar appears along the top of the application main window GUI just below the Horizontal Menu Bar. It contains the tab panes specified by the AIS Lisp programmer.

aboutQt

Overview

The mainWindow aboutQt function displays the contents of the special QT about message box. The mainWindow object must be showing for the aboutQt message box to work properly. The aboutQt function returns control when the GUI user presses the OK button on the message box. The contents of the message box are provided by QT and contain general information about the current release of QT. To display the current properties of the main window, use the maximize function.

 

Syntax

(qt mainWindow: aboutQt:)

Arguments

ReturnsAlways returns 0.

 

Example1

(qt mainWindow: setTitle: (append "My QT Message Box Demo."))
(qt mainWindow: maximize:) ;; Display the main window.
(qt mainWindow: aboutQt:) ;; Display the standard QT message box

addTab

Overview

The mainWindow addTab function adds a tab to the right on the horizontal tab bar of the main window. The tab must have a title, a GUI object descendant of RadWidget as its contents, and a tab manger Lambda to handle tab events properly. The aboutQt function returns control when the GUI user presses the OK button on the message box. The contents of the new tab are provided by radWidgetPtr argument, which muist be the returned value from a previous (qt new: RadWidget: ...) function call. The tabManager Lambda must provide the proper management of tab events.

 

Syntax

(setq tabIndex (qt mainWindow: addTab: radWidgetPtr title tabManager))

Arguments

radWidgetPtrA pointer to ANY QT GUI object with RadWidget as an ancestor.
titleThe text title to appear on the tab.
tabManagerThe Lambda tab manger function which must provide the proper behavior for tab events.
tabIndexAlways returns the index of the tab on the main window horizontal tab bar.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtr (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: addTab: radTextEditPtr "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(qt mainWindow: maximize:) ;; Display the main window

addMenu

Overview

The mainWindow addMenu function adds a manu to the right on the horizontal menu bar of the main window. The menu must have a title which is displayed on the main window horizontal menu bar. The returned main menu object pointer can be used to add vertical menu items beneath the main menu on the horizontal menu bar.

 

Syntax

(setq radMainMenuPtr (qt mainWindow: addMenu: title))

Arguments

titleThe text title to appear on the menu.
radMainMenuPtrAlways returns a pointer to the menu object on the main window horizontal menu bar.

 

Example1

(qt mainWindow: setTitle: (append "My QT Horizontal Menu Demo.")) ;; Set the main window title
(setq radMainMenuPtr (qt mainWindow: addMenu: "Help")) ;; Add a new tab to the main window horizontal menu bar
(qt mainWindow: maximize:) ;; Display the main window

count

Overview

The mainWindow count function returns the number of tabs on the horizontal tab bar of the main window.

 

Syntax

(setq tabCount (qt mainWindow: count:))

Arguments

tabCountAlways returns the count of tabs on the main window horizontal tab bar.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtr (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: addTab: radTextEditPtr "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(setq tabCount (qt mainWindow: count:)) ;; Return the count of tabs
(qt radTextEditPtr setText: (string tabCount)) ;; Display the main window
(qt mainWindow: maximize:) ;; Display the main window

getAis

Overview

The mainWindow getAis function returns and sets the global _ais Structure. The global _ais Structure contains important information about the current .exe context including the following elements.

 

Syntax

(setq _ais (qt mainWindow: getAis:))

Arguments

_aisAlways returns and sets the global _ais Structure.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtr (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: addTab: radTextEditPtr "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(qt mainWindow: getAis:) ;; Set the global _ais Structure
(qt radTextEditPtr setText: (string _ais true)) ;; Display the _ais Structure contents in the main window
(qt mainWindow: maximize:) ;; Display the main window

getClipboardText

Overview

The mainWindow getClipboardText function returns the text currently stored in the main window clipboard.

 

Syntax

(setq text (qt mainWindow: getClipboardText:))

Arguments

textAlways returns the text currently stored in the main window clipboard.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtr (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: addTab: radTextEditPtr "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(setq text (qt mainWindow: getClipboardText:)) ;; Set the clipboard text
(qt radTextEditPtr setText: text) ;; Display the clipboard contents in the main window
(qt mainWindow: maximize:) ;; Display the main window

getCurrentIndex

Overview

The mainWindow getCurrentIndex function returns the index of the currently selected tab in the main window horizontal tab bar.

 

Syntax

(setq tabIndex (qt mainWindow: getCurrentIndex:))

Arguments

tabIndexAlways returns the the index of the currently selected tab in the main window horizontal tab bar.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtr (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: addTab: radTextEditPtr "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(setq tabIndex (qt mainWindow: getCurrentIndex:)) ;; Set the index of the currently selected tab
(qt radTextEditPtr setText: (string tabIndex true)) ;; Display the index of the currently selected tab
(qt mainWindow: maximize:) ;; Display the main window

insertTab

Overview

The mainWindow insertTab function inserts a new tab on the main window horizontal tab bar at the specified tab index.

 

Syntax

(setq tabIndex (qt mainWindow: insertTab: tabIndex radWidgetPtr title tabManager))

Arguments

tabIndexAlways returns the the index of the newly inserted tab in the main window horizontal tab bar.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtr (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: insertTab: 0 radTextEditPtr "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(qt radTextEditPtr setText: (string tabIndex true)) ;; Display the index of the newly inserteded tab
(qt mainWindow: maximize:) ;; Display the main window

maximize

Overview

The mainWindow maximize function displays the main window in its full screen format.

 

Syntax

(qt mainWindow: maximize:))

(qt mainWindow: maximize: title))

Arguments

title(Optional) title to be set into the title bar of the main window.
ReturnsAlways returns void.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtr (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: insertTab: 0 radTextEditPtr "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(qt radTextEditPtr setText: (string tabIndex true)) ;; Display the index of the newly inserteded tab
(qt mainWindow: maximize:) ;; Display the main window

minimize

Overview

The mainWindow minimize function displays the main window in its minimal format for the host operating system.

 

Syntax

(qt mainWindow: minimize:))

(qt mainWindow: minimize: title))

Arguments

title(Optional) title to be set into the title bar of the main window.
ReturnsAlways returns void.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtr (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: insertTab: 0 radTextEditPtr "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(qt radTextEditPtr setText: (string tabIndex true)) ;; Display the index of the newly inserteded tab
(qt mainWindow: minimize:) ;; Display the main window in its most minimal format for the host operating system

removeTab

Overview

The mainWindow removeTab function removes the specified tab fromthe main window horizontal tab bar.

 

Syntax

(qt mainWindow: removeTab: tabIndex)

Arguments

tabIndexThe index of the tab to be removed from the main window horizontal tab bar.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtr (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: insertTab: 0 radTextEditPtr "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(qt radTextEditPtr setText: (string tabIndex true)) ;; Display the index of the newly inserteded tab
(qt mainWindow: maximize:) ;; Display the main window
(sleep 5000.0) ;; Wait for 5 seconds (qt mainWindow: removeTab:) ;; Remove the edit tab from the main window

setCurrentIndex

Overview

The mainWindow setCurrentIndex function sets the main window horizontal tab bar to focus on specified tab.

 

Syntax

(qt mainWindow: setCurrentIndex: tabIndex)

Arguments

tabIndexThe index of the tab to become the focused tab on the main window horizontal tab bar.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtrE (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: insertTab: 0 radTextEditPtrE "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(qt radTextEditPtrE setText: "Edit Tab Focused") ;; Display on the newly inserteded tab
(setq radTextEditPtrH (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: insertTab: 1 radTextEditPtrH "Help" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(qt radTextEditPtrH setText: "Help Tab Focused") ;; Display on the newly inserteded tab
(qt mainWindow: setCurrentIndex: 0) ;; Focus on the edit tab in the main window
(qt mainWindow: maximize:) ;; Display the main window
(sleep 5000.0) ;; Wait for 5 seconds (qt mainWindow: setCurrentIndex: 1) ;; Focus on the edit tab in the main window

setClipboardText

Overview

The mainWindow setClipboardText function sets the main window clipboard text to the specified value.

 

Syntax

(qt mainWindow: setClipboardText: theText)

Arguments

theTextThe text value to be set in the main window clipboard.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtr (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: insertTab: 0 radTextEditPtr "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(qt mainWindow: setClipboardText: "I set this text in the clipboard") ;; Set text into the main window clipboard
(setq theText (qt mainWindow: getClipboardText:)) ;; Get the contents of the main window clipboard
(qt radTextEditPtr setText: theText) ;; Display on the newly inserteded tab
(qt mainWindow: maximize:) ;; Display the main window

setTitle

Overview

The mainWindow setTitle function sets the contents of the main window title bar (but does not display the title bar). The AIS Lisp programmer has full control over the contents of the .exe title bar. To display the title bar and all other current properties of the main window, use the maximize function.

 

Syntax

(qt mainWindow: setTitle: textData)

Arguments

textDataThe text data to appear in the title bar.
ReturnsAlways returns void.

 

Example1

(qt mainWindow: setTitle: (append "My Application with [" (inspect) "] bytes of free heap memory."))
(qt mainWindow: maximize:) ;; Display the main window.

showMsgBox

Overview

The mainWindow showMsgBox function displays a standard message box and returns the button pressed. Several styles of standard message box may be shown. The standard message box may contain one or more buttons. If more than one button is displayed, the button pressed will be returned.

 

Syntax

(setq index (qt mainWindow: showMsgBox: style title message buttons))

Arguments

styleThe style of standard message box to display.
The style options are - (information question warning critical)
titleThe text title of the standard message box.
messageThe message to be displayed in the standard message box.
May be RichText with basic HTML tags, etc.
buttonsThe buttons to be displayed in the standard message box.
The button options are - Ok: Yes: No: YesNo:
YesNo displays two buttons and returns which button the user pressed (0=No, 1=Yes)
indexAlways returns the button pressed.

 

Example1

(qt mainWindow: setTitle: (append "My Application with [" (inspect) "] bytes of free heap memory."))
(qt mainWindow: maximize:) ;; Display the main window.
(setq index (qt mainWindow: showMsgBox: critical: "Warning" "Alien attack! Do you wish to resist?" YesNo:)) ;; Display a standard message box.

showOpenFileDialog

Overview

The mainWindow showOpenFileDialog function displays a standard Open File dialog box and returns the file and path name selected.

 

Syntax

(setq pathFileName (qt mainWindow: showOpenFileDialog: title pathName wildCards))

Arguments

titleThe text title of the standard open file dialog box.
pathNameThe path name to be used for browsing.
wildCardsThe wild cards to be used to limit browing choices.
pathFileNameAlways returns the path and file name selected.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtr (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: insertTab: 0 radTextEditPtr "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(qt mainWindow: maximize:) ;; Display the main window
(setq pathFileName (qt mainWindow: showOpenFileDialog: "Select a file" "" "*.sl")) ;; Display a standard open file dialog box.
(qt radTextEditPtr setText: pathFileName) ;; Display on the newly inserteded tab

showSaveFileDialog

Overview

The mainWindow showOpenFileDialog function displays a standard Save File dialog box and returns the file and path name selected.

 

Syntax

(setq pathFileName (qt mainWindow: showSaveFileDialog: title pathName wildCards))

Arguments

titleThe text title of the standard save file dialog box.
pathNameThe path name to be used for browsing.
wildCardsThe wild cards to be used to limit browing choices.
pathFileNameAlways returns the path and file name selected.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtr (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: insertTab: 0 radTextEditPtr "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(qt mainWindow: maximize:) ;; Display the main window
(setq pathFileName (qt mainWindow: showSaveFileDialog: "Select a file" "" "*.sl")) ;; Display a standard open file dialog box.
(qt radTextEditPtr setText: pathFileName) ;; Display on the newly inserteded tab