26
Windows Development Windows Development Library Library The Windows Development Library (WDL) consists of a series of IB source files that contain pre-built subroutines for performing almost any task you will need to communicate with or receive messages from a window, dialog, or dialog control. CometWin.Inc is the newest addition to the WDL suite. It provides a relatively simple framework for creating, manipulating, and presenting dialogs and controls from an IB program. This file contains both declarative and executable sections. CosWin.Ibs contains most of the low-level subroutines used by CometWin and the user program to manipulate windows and controls. To reduce the amount of unused code that may be present in CosWin.Ibs, symbolic constants or “feature controls” are used to include/exclude blocks of code. CosWin.Inc contains the declaratives required by CosWin.Ibs. Additional files in the WDL provide feature support for individual controls. These files are automatically included by CosWin as determined by the CosWin feature controls.

Windows Development Library

  • Upload
    rio

  • View
    28

  • Download
    1

Embed Size (px)

DESCRIPTION

Windows Development Library. The Windows Development Library (WDL) consists of a series of IB source files that contain pre-built subroutines for performing almost any task you will need to communicate with or receive messages from a window, dialog, or dialog control. - PowerPoint PPT Presentation

Citation preview

Page 1: Windows Development Library

Windows Development LibraryWindows Development Library The Windows Development Library (WDL) consists of a series

of IB source files that contain pre-built subroutines for performing almost any task you will need to communicate with or receive messages from a window, dialog, or dialog control.– CometWin.Inc is the newest addition to the WDL suite. It provides a

relatively simple framework for creating, manipulating, and presenting dialogs and controls from an IB program. This file contains both declarative and executable sections.

– CosWin.Ibs contains most of the low-level subroutines used by CometWin and the user program to manipulate windows and controls. To reduce the amount of unused code that may be present in CosWin.Ibs, symbolic constants or “feature controls” are used to include/exclude blocks of code.

– CosWin.Inc contains the declaratives required by CosWin.Ibs.– Additional files in the WDL provide feature support for individual

controls. These files are automatically included by CosWin as determined by the CosWin feature controls.

Page 2: Windows Development Library

CometWin.IncCometWin.Inc CometWin.Inc must be included twice in your program

source. Once in each of the declarative and executable sections. Based on the value of pre-defined symbolic constants (Set <const> =) CometWin will automatically include any other library files that are needed to build your program.

Using the new EventSub statement event management, CometWin provides frameworks for writing dialog based applications and also “direct” applications where controls are placed directly onto the Comet screen.

Attempts to minimize the code required to operate a windowed program without overwhelming the programmer.

Variables, constants and subroutines contained in the CometWin files all begin with the “CW” prefix.

Page 3: Windows Development Library

CosWin.IbsCosWin.Ibs

CosWin.Ibs provides all of the low-level subroutines necessary to communicate with a window, dialog, or control being hosted by COSW. This includes routines to:– Show or hide a window– Enable or disable a window– Change the size, position or ‘Z’ order of a window– Change the input focus of a window– Exchange data with windows– Modify window behaviors– Convert data from one form to another

Most variables, constants and subroutines contained in the CosWin files begin with the prefix “cos” or “COS”.

Page 4: Windows Development Library

Using CometWinUsing CometWinInclude "CometWin.Inc ! DeclarativesInclude “MyDll.Inc” ! DLL constants

ClearEventSub EventHandler CW.Event$ CW.Source$cosDllNames$ = “MyDll” ! DLL filenamecosDllDir$ = “Dat” ! DLL DirectorycosDlgId = IDD.MYDIALOG ! Dialog IDGosub CW.CreateAutoModeDialog ! Execute dialog

Stop

EventHandler:Gosub CW.ParseEventGosub CW.CheckAutoModeClosingIf (CW.ExitEvents EQ TRUE)

EventSubElse

EventSub EventHandler CW.Event$ CW.Source$EndIf

Return

Include "CometWin.Inc“ ! Executable

Page 5: Windows Development Library

CometWin - Dialog Create CometWin - Dialog Create FunctionsFunctions

CW.CreateModalDialog– Creates a “modal” dialog. When created the parent window

is disabled until the dialog is closed. This is your standard, every-day popup style dialog.

CW.CreateModelessDialog– Creates a “modeless” dialog. The parent window remains

active. This dialog is a child of the COSW “view” window where it can be seamlessly embedded to look integrated with the COSW window.

CW.CreateAutoModeDialog - NEW– Creates either a modal or modeless dialog based upon the

whether or not the dialog has the “child” window property.

Page 6: Windows Development Library

CometWin – Dialog Event CometWin – Dialog Event Processing FunctionsProcessing Functions

CW.ParseEvent parses an incoming event into the appropriate variables.

CW.IsWindowInitializing checks to see if a dialog is initializing. This checks for the WM.INITDIALOG message.

CW.IsWindowClosing checks to see if the window has closed. This checks for the WM.DESTROY message.

CW.CheckAutoModeClosing checks to see if an auto-mode dialog is closing. Same as CW.IsWindowClosing but also restores the screen and cursor for modeless dialogs. Applies to auto-mode dialogs only.

CW.CloseAutoModeDialog closes an auto-mode dialog. Applies to auto-mode dialogs only.

CW.AutoSizeDialog sizes a modeless dialog to fit the “view” window or sizes the “view” window to fit the dialog. It also fills in the the “view” window with the standard dialog color to match the dialog background..

CW.AutoSizeDialogEx same as CW.AutoSizeDialog only allows the user to specify the “view” fill color.

Page 7: Windows Development Library

CosWin Window and Control CosWin Window and Control SupportSupport

CosWin provides an assortment of subroutines that can be used to manipulate and communicate with the various windows and controls that you may place in your dialog. The subroutines fall into four general categories.– Subroutines that perform “utility” functions.– Subroutines that are common to most windows.– Subroutines that are common to most controls.– Subroutines that are specific to a particular type of

window or control.

Page 8: Windows Development Library

Utility SubroutinesUtility Subroutines

CosWin provides many subroutines that are useful when dealing with parameters sent to and received from windows and controls. Often used subroutines include:

– COS.GetViewWnd and COS.GetAppWnd return a handle to the COSW “view” window. This window is often the “parent” to any dialog being displayed.

– COS.GetFrameWnd returns a handle to outer Comet “frame” window. This is the window that contains the Comet titlebar, menu, status and tool bars and the “view” window.

– COS.GetDialogBaseUnits returns a factor for converting dialog units to pixels and vice-versa.– COS.MapDialogRect converts a pixel-based rectangle to dialog coordinates.– COS.ClientToScreen converts client coordinates (parent relative) to screen coordinates.– COS.ScreenToClient converts screen coordinates to client (parent relative) coordinates.– COS.GetSystemMetrics returns the value of various system parameters like screen size, etc.– COS.GetSysColor returns the RGB color of various system components.– COS.SizeViewToDialog changes the size of the Comet window so that a dialog fits perfectly

within the “view” window.– COS.SetViewSize sets the size of the Comet window such that the “view” window will be the

specified size.– COS.SetCaption sets the caption text of the Comet titlebar.– COS.SetStatusMessage sets the caption text of the Comet status bar.– COS.SetDialogColor Changes the background color or a dialog.

Page 9: Windows Development Library

Common Window SubroutinesCommon Window SubroutinesMany subroutines can be applied to any window whose handle is known. Often used subroutines include:

– COS.MoveWindow using screen coordinates, changes a window’s size and location.– COS. SetWindowPosEx using client coordinates, changes any or all of a window’s size, location,

and ‘Z’ order.– COS. GetDlgItem retrieves the window “handle” to a control known only by is ID.– COS.GetWindowText returns the text for a window.– COS.SetWindowText sets the text for a window.– COS.GetWindowTextLength returns the number of bytes in a window’s text.– COS.SendMessage sends a message to a window– COS.PostMessage posts a message to a window– COS.ShowWindow shows or hides a window.– COS.IsWindowVisible determines if a window is currently visible.– COS.EnableWindow enables or disables a window.– COS.IsWindowEnabled determines if a window is currently enabled.– COS.GetFocus returns a handle to the window that has the input focus.– COS.GetParent returns the handle to a window’s parent window.– COS.SetParent sets the handle to a windows parent.– COS.GetWindowRect returns the rectangular coordinates of a window.– COS.GetClientRect returns the coordinates of a window’s client area.– COS.GetWindowLong returns the value of various window parameters– COS.SetWindowLong sets the value of various window parameters

Page 10: Windows Development Library

Common Control SubroutinesCommon Control SubroutinesMany subroutines can be applied to any control whose parent handle and ID is known. Often used subroutines include:

– COS.GetDlgItemText returns the text in a control.– COS.SetDlgItemText sets the text in a control.– COS.GetDlgItemTextLength returns the length of the text in a control.– COS.SetDlgItemFocus sets the input focus to a control.– COS.EnableDlgItem enables or disables a control.– COS.ShowDlgItem shows or hides a control.– COS.SendDlgItemMessage sends a message to a control.– COS.SetControlColors Sets the colors for a specified control. This code

affects only Static Text, Edit, RadioButton, CheckBox and ListBox controls.

You may notice that these subroutines are simply the control equivalent of an existing window based subroutine. Additional control subroutines can easily be added to CosWin by using COS.GetDlgItem to retrieve the handle to a control’s window and then calling the appropriate window based version of the subroutine.

Page 11: Windows Development Library

Enabling Control Specific Enabling Control Specific SubroutinesSubroutines

There are many subroutines in CosWin that are provided to support each type of control that is supported by a Comet program. This includes “direct” programs that are not dialog based. The code for these subroutines may not be be included in your program without the inclusion of a CosWin “Feature Control”. A feature control is nothing more than a symbolic constant that is defined in your source code before including the file CometWin.Inc (or CosWin.Inc). A feature control takes the form of “CF.” followed by the name of the feature. For instance the statement “Set CF.LIST.BOX = 1” tells CosWin that you want the subroutines to support a ListBox control included in your program. Some control-specific subroutines that are used heavily in most applications (primarily buttons and edit controls) are always included in your program.

The Feature Controls currently supported by CosWin are:

CF.LISTBOX.CODE CF.COMBOBOX.CODECF.PICBUTTON.CODE CF.PICFRAME.CODE

CF.TABCTRL.CODE CF.PROGRESS.CODECF.CALENDAR.CODE CF.DATETIME.CODECF.IPADDR.CODE CF.LISTVIEW.CODECF.TREEVIEW.CODE CF.SCROLL.CODECF.SLIDER.CODE CF.SPIN.CODE

Page 12: Windows Development Library

Button SubroutinesButton Subroutines COS.CheckDlgButton Selects (places check mark next to) or clears

(removes check mark from) a button, or it changes the state of a three-state button.

COS.IsDlgButtonChecked Determines whether a button control has a check mark next to it or if three-state if is indeterminate.

COS.CheckRadioBtn Selects the indicated RadioButton (turning of all others) from the specified RadioButton group.

COS.GetCheckedRadioBtn Returns the selected RadioButton from the specified RadioButton group.

COS.SetDlgButtonStyle Changes the style of the specified PushButton.

These subroutines require the CF.PICBUTTON.CODE Feature Control.

COS.LoadButtonPic Loads a resource bitmap pushbutton with a specified set of pictures.

COS.AutoLoadButtonPic Loads a resource bitmap pushbutton with pictures specified by the button text.

Page 13: Windows Development Library

Edit Control SubroutinesEdit Control Subroutines

COS.EditSetReadOnly Sets the Edit control to read-only. COS.EditLimitText Limits the number of characters in the control. COS.AttachNumericEdit Enables Numeric Edit behavior in a Edit control. COS.EditSetSel Sets the current selection in an Edit control. COS.EditFmtLines determines whether a multiline edit control includes soft

line-break characters. COS.EditReplaceSel Replaces the current selection in an edit control with

the specified text. COS.NumEditSetDigits Sets the length and precision for a Numeric Edit

control. COS.NumEditSetFlags Sets the behavior flags for a Numeric Edit control. COS.AttachMaskedEdit Enables Masked Edit behavior in a Edit control. COS.MaskedEditSetMask Sets the edit mask for a Masked Edit control

Page 14: Windows Development Library

ListBox Control SubroutinesListBox Control SubroutinesThese subroutines require the CF.LISTBOX.CODE Feature Control.

COS.ListSetCurSel Selects the current specified item in a ListBox. COS.ListGetCurSel Returns the currently selected item in a ListBox. COS.ListSetSel Selects an item in a multiple-selection ListBox. COS.ListSetCaretIndex Sets the focus rectangle to the item at the specified index in a multiple-

selection list box. COS.ListSetTabStops Sets the tab stops for a ListBox. COS.ListGetSelItems Returns a list of the items selected in a multiple-selection ListBox. COS.ListGetSelCount Returns the number of items selected in a multiple-selection ListBox. COS.ListFindString Finds the first string in a ListBox that begins with the specified text. COS.ListGetTopIndex Retrieves the index of the item at the top of the visible area of a ListBox. COS.ListSetTopIndex Sets the item at the top of the visible area of a ListBox to specified Item. COS.ListSetHorzExtent Sets the horizontal extent for a ListBox to achieve horizontal scrolling. COS.ListDelString Deletes a string at a specified position from a ListBox. COS.ListInsertString Inserts a string at a specified position into a ListBox. COS.ListResetContent Resets (clears) the contents of a ListBox. COS.ListGetCount Returns the number of items in a ListBox. COS.ListAddString Appends a string into a ListBox. COS.ListAddStringData Appends a string and a associated 32 bit (10.0) numeric value into a ListBox. COS.ListSetItemData Sets the associated 32 bit (10.0) value for a string in a ListBox. COS.ListGetItemData Returns the 32 bit (10.0) value associated with a string in a ListBox. COS.ListGetText Returns the string contents associated with a specified item is a ListBox.

Page 15: Windows Development Library

ComboBox Control SubroutinesComboBox Control Subroutines

These subroutines require the CF.COMBOBOX.CODE Feature Control.

COS.ComboSetCurSel Sets the current selected item in a ComboBox. COS.ComboGetCurSel Returns the current selected item in a ComboBox. COS.ComboDeleteString Deletes the specified item from the combo box COS.ComboShowDropDown Opens/Closes the dropdown ListBox portion of a ComboBox. COS.ComboLimitText Limits the number of characters that can be entered into a ComboBox Edit

control. COS.ComboSetEditSel Selects a range of characters in an ComboBox Edit control. COS.ComboAddStringData Appends a string and a associated 32 bit (10.0) numeric value into a

ComboBox. COS.ComboAddString Appends a string into a ComboBox. COS.ComboInsertString Inserts a string at a specified position into a ComboBox. COS.ComboFindString Finds the first string in a ComboBox that begins with the specified text. COS.ComboFindStringExact Finds the first string in a ComboBox that exactly matches the specified

text. COS.ComboGetCount Returns the number of items in a ComboBox. COS.ComboResetContent Resets (clears) the contents of a ComboBox. COS.ComboSetItemData Sets the associated 32 bit (10.0) value for a string in a ComboBox. COS.ComboGetItemData Returns the associated 32 bit (10.0) value for a string in a ComboBox. COS.ComboGetText Returns the string contents associated with a specified item is a

ComboBox.

Page 16: Windows Development Library

Picture Control SubroutinesPicture Control Subroutines

These subroutines require the CF.PICFRAME.CODE Feature Control.

COS.LoadPictureControl Attaches the specified bitmap file to a Picture control.

Page 17: Windows Development Library

Tab Control SubroutinesTab Control Subroutines

These subroutines require the CF.TABCTRL.CODE Feature Control.

COS.TabCtrl.Attach Enables “enhanced” capabilities in a Tab control. COS.TabCtrl.AdjustRect Calculates a Tab control's display area given a window

rectangle, or calculates the window rectangle that would correspond to a specified display area.

COS.TabCtrl.SetTabBkColor Sets the background color of a “enhanced” Tab control. COS.TabCtrl.InsertItem Inserts a new tab in a Tab control. COS.TabCtrl.SetItem Sets some or all of the attributes for a tab in a Tab control. COS.TabCtrl.GetItem Retrieves information about a tab in a Tab control. COS.TabCtrl.GetCurSel Returns the currently selected tab in a Tab control. COS.TabCtrl.SetCurSel Sets the currently selected tab in a Tab control.

Page 18: Windows Development Library

Progress Control SubroutinesProgress Control Subroutines

These subroutines require the CF.PROGRESS.CODE Feature Control.

COS.Progress.SetRange Sets the range of a Progress bar control to a 32-bit (10.0) value.

COS.Progress.SetStep Specifies the step increment for a Progress bar. The default is 10.

COS.Progress.StepIt Advances the current position for a Progress bar by the step increment.

COS.Progress.OffsetPos Advances the current position of a Progress bar by a specified increment .

COS.Progress.SetPos Sets the current position for a Progress bar COS.Progress.GetPos Returns the current position of a Progress bar.

Page 19: Windows Development Library

MonthCalendar Control MonthCalendar Control SubroutinesSubroutines

These subroutines require the CF.PROGRESS.CODE Feature Control.

COS.MonthCal.SetToday Sets the "today" selection for a MonthCalendar control.

COS.MonthCal.SetCurSel Sets the currently selected date for a MonthCalendar control.

COS.MonthCal.GetCurSel Returns the currently selected date in a MonthCalendar control.

COS.MonthCal.GetToday Returns the date information for the date specified as "today" for a MonthCalendar control.

Page 20: Windows Development Library

DateTimePicker Control DateTimePicker Control SubroutinesSubroutines

These subroutines require the CF.DATETIME.CODE Feature Control.

COS.SetSystemTime Sets the time in a DateTimePicker control. COS.GetSystemTime Returns the currently selected time in a

DateTimePicker control.

Page 21: Windows Development Library

IPAddress Control IPAddress Control SubroutinesSubroutines

These subroutines require the CF.IPADDR.CODE Feature Control.

COS.IPAddr.ClearAddress Clears the contents of the IPAddress control. COS.IPAddr.IsBlank Determines if all fields in the IPAddress control are

blank. COS.IPAddr.SetFocus Sets the keyboard focus to the specified field in the

IPAddress control. COS.IPAddr.SetRange Sets the valid range for the specified field in the

IPAddress control. COS.IPAddr.SetAddress Sets the address values for all four fields in the

IPAddress control. COS.IPAddr.GetAddress Returns the address values for all four fields in the

IPAddress control.

Page 22: Windows Development Library

ListView Control SubroutinesListView Control SubroutinesThese subroutines require the CF.LISTVIEW.CODE Feature Control.

COS.ListView.InsertTextColumn Inserts a column with a text heading into a ListView control. COS.ListView.SetColumnWidth Sets the width of a column in a ListView control. COS.ListView.SetColumn Sets the attributes of a ListView column. COS.ListView.GetItemText Returns the text for an item in a ListView control. COS.ListView.GetItem Returns some or all of a ListView item's attributes. COS.ListView.InsertStringItem Inserts a new text item into a ListView control. COS.ListView.SortItems Sort the items in a ListView control. COS.ListView.SetItemText Sets the text of an item in a ListView control. COS.ListView.SetItemData Sets a 32 bit (10.0) value to be associated with an item in a ListView

control. COS.ListView.SetItemState Changes the state of an item in a ListView control. COS.ListView.GetExtendedStyle Returns the extended style of a ListView control. COS.ListView.SetExtendedStyle Changes the extended style of a ListView control. COS.ListView.SetFullRowSelect Enables full row select for a ListView control. COS.ListView.GetNextItem Returns information on the next item following a specified item in a

ListView control. COS.ListView.DeleteItem Deletes an item from a ListView control. COS.ListView.EnsureVisible Ensures that a ListView item is either entirely or partially visible,

scrolling the ListView control if necessary. COS.ListView.DeleteAllItems Deletes all items in a ListView control.

Page 23: Windows Development Library

TreeView Control SubroutinesTreeView Control SubroutinesThese subroutines require the CF.TREEVIEW.CODE Feature Control.

The following are the most common subroutines for manipulating a TreeView control and are a sub-set of those provided by CosWin.

COS.TreeView.InsertItem Inserts an item into a TreeView control. COS.TreeView.DeleteAllItems Deletes all items in a TreeView control. COS.TreeView.DeleteItem Deletes an item from a TreeView control. COS.TreeView.SelectItem Selects an item in a TreeView control. COS.TreeView.GetCount: Returns the number of items in a TreeView control. COS.TreeView.GetNextItem Returns the next item following a specified item in a

TreeView control. COS.TreeView.GetItemText Returns the text for a specified item in a TreeView

control. COS.TreeView.SetItemText Sets the text of a item in a TreeView control.

Page 24: Windows Development Library

ScrollBar Control SubroutinesScrollBar Control Subroutines

These subroutines require the CF.SCROLL.CODE Feature Control.

COS.Scroll.SetPos Sets the current position of the scroll box of a ScrollBar control. COS.Scroll.GetPos Returns the current position of the scroll box of a ScrollBar control. COS.Scroll.SetRange Sets the minimum and maximum position values for a ScrollBar

control.

Page 25: Windows Development Library

Slider Control SubroutinesSlider Control Subroutines

These subroutines require the CF.SLIDER.CODE Feature Control.

COS. Slider.SetPos Sets the current logical position of the slider in a Slider control. COS.Slider.GetPos Returns the current logical position of the slider in a Slider control. COS. Slider.SetRange Sets the range of minimum and maximum logical positions for

the slider in a Slider control.

Page 26: Windows Development Library

Spin Control SubroutinesSpin Control Subroutines

These subroutines require the CF.SPIN.CODE Feature Control.

COS. Spin.SetPos Sets the current logical position of a Spin control. COS.Spin.GetPos Returns the current logical position of a Spin control. COS. Spin.SetRange Sets the range of minimum and maximum logical positions for a

Spin control.