Gupta.narod.ru - примеры программирования на Gupta Team Developer 2005 (GTD, CTD, TOM, Quest, SQLTalk, Report Builder, SQLWindows, SQLBase, Oracle, Web Developer, Team Object Manager)

Найти: на
Скачать пример в архиве vtmenuExt
Вернуться на страницу архива примеров

.head 0 +  Application Description: Centura SQLWindows/32 Standard Application Template
.head 1 -  Outline Version - 4.0.27
.head 1 +  Design-time Settings
.data VIEWINFO
0000: 6F00000001000000 FFFF01000D004347 5458566965775374 6174650400010000
0020: 0000000000BC0000 002C000000020000 0003000000FFFFFF FFFFFFFFFFFCFFFF
0040: FFE9FFFFFFFFFFFF FF000000007C0200 004D010000010000 0001000000010000
0060: 000F4170706C6963 6174696F6E497465 6D00000000
.enddata
.head 2 -  Outline Window State: Normal
.head 2 +  Outline Window Location and Size
.data VIEWINFO
0000: 6600040003002D00 0000000000000000 0000B71E5D0E0500 1D00FFFF4D61696E
0020: 0000000000000000 0000000000000000 0000003B00010000 00000000000000E9
0040: 1E800A00008600FF FF496E7465726E61 6C2046756E637469 6F6E730000000000
0060: 0000000000000000 0000000000003200 0100000000000000 0000E91E800A0000
0080: DF00FFFF56617269 61626C6573000000 0000000000000000 0000000000000000
00A0: 3000010000000000 00000000F51E100D 0000F400FFFF436C 6173736573000000
00C0: 0000000000000000 0000000000000000
.enddata
.data VIEWSIZE
0000: D000
.enddata
.head 3 -  Left: -0.013"
.head 3 -  Top:    0.0"
.head 3 -  Width:  8.013"
.head 3 -  Height: 4.969"
.head 2 +  Options Box Location
.data VIEWINFO
0000: D4180909B80B1A00
.enddata
.data VIEWSIZE
0000: 0800
.enddata
.head 3 -  Visible? No
.head 3 -  Left: 4.15"
.head 3 -  Top:    1.885"
.head 3 -  Width:  3.8"
.head 3 -  Height: 2.073"
.head 2 +  Class Editor Location
.head 3 -  Visible? No
.head 3 -  Left: 0.575"
.head 3 -  Top:    0.094"
.head 3 -  Width:  5.063"
.head 3 -  Height: 2.719"
.head 2 +  Tool Palette Location
.head 3 -  Visible? No
.head 3 -  Left: 6.388"
.head 3 -  Top:    0.729"
.head 2 -  Fully Qualified External References? Yes
.head 2 -  Reject Multiple Window Instances? No
.head 2 -  Enable Runtime Checks Of External References? Yes
.head 2 -  Use Release 4.0 Scope Rules? No
.head 1 -  Libraries
.head 1 +  Global Declarations
.head 2 +  Window Defaults
.head 3 +  Tool Bar
.head 4 -  Display Style? Etched
.head 4 -  Font Name: MS Sans Serif
.head 4 -  Font Size: 8
.head 4 -  Font Enhancement: System Default
.head 4 -  Text Color: System Default
.head 4 -  Background Color: System Default
.head 3 +  Form Window
.head 4 -  Display Style? Etched
.head 4 -  Font Name: MS Sans Serif
.head 4 -  Font Size: 8
.head 4 -  Font Enhancement: System Default
.head 4 -  Text Color: System Default
.head 4 -  Background Color: System Default
.head 3 +  Dialog Box
.head 4 -  Display Style? Etched
.head 4 -  Font Name: MS Sans Serif
.head 4 -  Font Size: 8
.head 4 -  Font Enhancement: System Default
.head 4 -  Text Color: System Default
.head 4 -  Background Color: System Default
.head 3 +  Top Level Table Window
.head 4 -  Font Name: MS Sans Serif
.head 4 -  Font Size: 8
.head 4 -  Font Enhancement: System Default
.head 4 -  Text Color: System Default
.head 4 -  Background Color: System Default
.head 3 +  Data Field
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Multiline Field
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Spin Field
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Background Text
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Pushbutton
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 3 +  Radio Button
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Check Box
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Option Button
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 3 +  Group Box
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Child Table Window
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  List Box
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Combo Box
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Line
.head 4 -  Line Color: Use Parent
.head 3 +  Frame
.head 4 -  Border Color: Use Parent
.head 4 -  Background Color: 3D Face Color
.head 3 +  Picture
.head 4 -  Border Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 2 +  Formats
.head 3 -  Number: 0'%'
.head 3 -  Number: #0
.head 3 -  Number: ###000
.head 3 -  Number: ###000;'($'###000')'
.head 3 -  Date/Time: hh:mm:ss AMPM
.head 3 -  Date/Time: M/d/yy
.head 3 -  Date/Time: MM-dd-yy
.head 3 -  Date/Time: dd-MMM-yyyy
.head 3 -  Date/Time: MMM d, yyyy
.head 3 -  Date/Time: MMM d, yyyy hh:mm AMPM
.head 3 -  Date/Time: MMMM d, yyyy hh:mm AMPM
.head 2 -  External Functions
.head 2 +  Constants
.data CCDATA
0000: 3000000000000000 0000000000000000 00000000
.enddata
.data CCSIZE
0000: 1400
.enddata
.head 3 -  System
.head 3 -  User
.head 2 -  Resources
.head 2 -  Variables
.data RESOURCE 0 0 1 978785135
0000: 1E00000011000000 0000000000000000 0200000100000004 000000E0010D0000
0020: 00FF3F
.enddata
.head 2 +  Internal Functions
.head 3 -  ! ! Menu
.head 3 +  Function: VisMenuAddPicture
.head 4 -  Description: author:	tl
date:	4.7.2002
version:	1.00


desc:

Adds a picture to menuentry.

parameter:

phWndForm	The handle of the main menuwindow (mostly hWndForm )
psPos		The location of the menu, seperated by '>'
pbTextLoc	TRUE  the location is given in menutext
		FALSE the location is given by position, starting at zero
phPicture		the handle of a picture (.. VisPicLoad )
phFont		! optional the handle of a font , if 0 the font is taken from the parent window

example:

Call VisMenuAddPicture(fwMain, 'Menu>Disable>Disable',TRUE, ghPicMinusLt, 0)

Call VisMenuAddPicture(fwMain, '1>0',FALSE, ghPicOpen, 0)
.head 4 +  Returns
.head 5 -  Boolean:
.head 4 +  Parameters
.head 5 -  Window Handle: phWndForm
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  String: psPos
.head 5 -  Boolean: pbTextLoc
.head 5 -  Number: phPicture
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: pnColorTransparent
.head 5 +  Number: pnColorNew
.head 6 -  ! If NUMBER_Null the std 3dFace color is taken
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  String: lsText
.head 5 -  String: lsFontName
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: lnFontSize
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: lnFontEnh
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: lhFont
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: nCount
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: nPos
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: hMenu
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  String: lsPos [*]
.head 5 -  Number: lnMenuCount
.head 5 -  Number: nIdx
.data INHERITPROPS
0000: 0100
.enddata
.head 4 +  Actions
.head 5 -  ! search for the menuentry
.head 5 -  Set hMenu = VisMenuGetHandle( phWndForm )
.head 5 -  Set lnMenuCount = SalStrTokenize( psPos,"", ">", lsPos )
.head 5 +  While nIdx < lnMenuCount - 1
.head 6 +  If pbTextLoc
.head 7 -  Set nPos = VisMenuGetPos( phWndForm, hMenu, lsPos[nIdx])
.head 6 +  Else
.head 7 -  Set nPos = SalStrToNumber(lsPos[nIdx])
.head 6 +  If nPos = -1
.head 7 -  Return FALSE
.head 6 -  Set hMenu = VisMenuGetPopupHandle( hMenu,  nPos)
.head 6 -  Set nIdx = nIdx + 1
.head 5 -  ! the position of the text
.head 5 +  If pbTextLoc
.head 6 -  Set nPos = VisMenuGetPos( phWndForm, hMenu, lsPos[nIdx])
.head 5 +  Else
.head 6 -  Set nPos = SalStrToNumber(lsPos[nIdx])
.head 5 +  If nPos = -1
.head 6 -  Return FALSE
.head 5 -  ! read text
.head 5 -  Set lsText =  VisMenuGetText(phWndForm, hMenu, nPos)
.head 5 -  ! and set
.head 5 -  Call VisMenuSetPictureX(phWndForm, hMenu, nPos,phPicture, phPicture,lsText,pnColorTransparent, pnColorNew )
.head 5 -  Return TRUE
.head 3 +  Function: VisMenuAddPictureRessource
.head 4 -  Description: author:	tl
date:	4.7.2002
version:	1.00


desc:

Adds a picture to menuentry.

parameter:

phWndForm	The handle of the main menuwindow (mostly hWndForm )
psPos		The location of the menu, seperated by '>'
pbTextLoc	TRUE  the location is given in menutext
		FALSE the location is given by position, starting at zero
phPicture		the handle of a picture (.. VisPicLoad )
phFont		! optional the handle of a font , if 0 the font is taken from the parent window

example:

Call VisMenuAddPicture(fwMain, 'Menu>Disable>Disable',TRUE, 'bmpDelete', PIC_FormatBitmap,0)

Call VisMenuAddPicture(fwMain, '1>0',FALSE, ghPicOpen,PIC_FormatBitmap, 0)
.head 4 +  Returns
.head 5 -  Boolean:
.head 4 +  Parameters
.head 5 -  Window Handle: phWndForm
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  String: psPos
.head 5 -  Boolean: pbTextLoc
.head 5 +  String: psPicRessource
.data INHERITPROPS
0000: 0100
.enddata
.head 6 -  ! the name of the ressource
.head 5 -  Number: pnColorTransparent
.head 5 +  Number: pnColorNew
.head 6 -  ! If NUMBER_Null the std 3dFace color is taken
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: lhPicture
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Boolean: lbResult
.data INHERITPROPS
0000: 0100
.enddata
.head 4 +  Actions
.head 5 -  Set lhPicture = VisPicLoad( PIC_LoadSWinRes | PIC_FormatBitmap, psPicRessource, "" )
.head 5 -  Set lbResult = VisMenuAddPicture(phWndForm, psPos, pbTextLoc, lhPicture,pnColorTransparent, pnColorNew   )
.head 5 -  Return lbResult
.head 3 +  Function: VisMenuGetPos
.head 4 -  Description: author:	tl
date:	4.7.2002
version:	1.00


desc:

Searches the menuentry by string and
returns the index. The index starts at 0,
when not found -1 is returned.

example:

Set nPos =  VisMenuGetPos (hWndForm, hMenu, 'Testentry' )
.head 4 +  Returns
.head 5 -  Number:
.head 4 +  Parameters
.head 5 -  Window Handle: phWndForm
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: hMenu
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  String: psMenuText
.data INHERITPROPS
0000: 0100
.enddata
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: nPos
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  String: lsText
.head 5 -  Number: nCount
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: hMenuPopup
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  String: lsTextNoAcc
.head 5 -  Number: lnLength
.head 5 -  String: lsTextRest
.head 5 -  Number: nAcc
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  String: lsAcc
.head 4 +  Actions
.head 5 -  Set nCount = VisMenuGetCount( hMenu )
.head 5 -  Set nPos = 0
.head 5 +  While nPos < nCount
.head 6 -  Set hMenuPopup = VisMenuGetPopupHandle( hMenu, nPos )
.head 6 -  Set lnLength = SalStrLength(psMenuText)
.head 6 -  Set lsText = VisMenuGetText( phWndForm, hMenu, nPos )
.head 6 -  Set lsTextRest = SalStrRightX( lsText, SalStrLength( lsText) - lnLength )
.head 6 -  ! get accelerator in textrest
.head 6 -  Set nAcc = VisMenuGetAccelerator( phWndForm, hMenu, nPos, lsAcc )
.head 6 -  ! now check if in textrest
.head 6 +  If nAcc > -1 and nAcc >= lnLength
.head 7 -  Set lsTextNoAcc = SalStrLeftX(lsText, nAcc )
.head 6 +  Else
.head 7 -  Set lsTextNoAcc = lsText
.head 6 -  !
.head 6 +  If lsTextNoAcc= psMenuText
.head 7 -  Return nPos
.head 6 -  Set lsTextNoAcc = VisStrSubstitute( lsTextNoAcc, '&', '' )
.head 6 +  If lsTextNoAcc = psMenuText
.head 7 -  Return nPos
.head 6 -  Set nPos = nPos + 1
.head 5 -  ! not found
.head 5 -  Return -1
.head 3 +  Function: VisMenuGetAccelerator
.head 4 -  Description: author:	tl
date:	4.7.2002
version:	1.00


desc:

example:


.head 4 +  Returns
.head 5 -  Number:
.head 4 +  Parameters
.head 5 -  Window Handle: phWndForm
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: hMenu
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: nPos
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Receive String: rsAcc
.data INHERITPROPS
0000: 0100
.enddata
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: nAcc
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  String: lsText
.head 5 -  String: lsAcc[16]
.head 5 -  Number: lnIdx
.head 4 +  Actions
.head 5 -  Set lsAcc[0] = "Alt+"
.head 5 -  Set lsAcc[1] = "Ctrl+"
.head 5 -  Set lsAcc[2] = "Shift+"
.head 5 -  Set lsAcc[3] = "F1"
.head 5 -  Set lsAcc[4] = "F2"
.head 5 -  Set lsAcc[5] = "F3"
.head 5 -  Set lsAcc[6] = "F4"
.head 5 -  Set lsAcc[7] = "F5"
.head 5 -  Set lsAcc[8] = "F6"
.head 5 -  Set lsAcc[9] = "F7"
.head 5 -  Set lsAcc[10] = "F8"
.head 5 -  Set lsAcc[11] = "F9"
.head 5 -  Set lsAcc[12] = "F10"
.head 5 -  Set lsAcc[13] = "F11"
.head 5 -  Set lsAcc[14] = "F12"
.head 5 -  Set lsAcc[15] = "Del"
.head 5 -  !
.head 5 -  Set lsText = VisMenuGetText( phWndForm, hMenu, nPos )
.head 5 -  !
.head 5 +  While lnIdx < 16
.head 6 -  Set nAcc = SalStrScan( lsText, lsAcc[lnIdx] )
.head 6 +  If nAcc != -1
.head 7 -  Break
.head 6 -  Set lnIdx = lnIdx + 1
.head 5 +  If nAcc = -1
.head 6 -  Set rsAcc = STRING_Null
.head 5 +  Else
.head 6 -  Set rsAcc = SalStrRightX(lsText, SalStrLength( lsText) - nAcc )
.head 5 -  Return nAcc - 1
.head 3 +  Function: VisMenuSetPictureX
.head 4 -  Description: author:	tl
date:	4.7.2002
version:	1.00


desc:

Works like VisMenuSetPicture (nut does not destroys the font)

parameter:

phWndForm	- Handle to window containing menu.
phMenu 		- Handle to menu containing item to display picture with.
pnPos		- Zero-based position within the menu of the item. Menu positions include separators. If negative, identifies a menu item added using VisMenuInsert
		, which always returns a negative menu ID value.
pnPicNormal	- Handle of picture to display in menu item when item is not selected. Call VisPicLoad to create a picture handle.
pnPicSelect	- Handle of picture to display in menu item when item is selected. Note that the parameters hPicNormal and hPicSelect may be the same.

psText 		- Text of item to insert. Specify \t to insert a tab in the text. A tab separates the menu text from the accelerator indicator. All text after the tab is shown along the right edge of the menu. If the menu text is a null string, only the picture is shown. If a picture and text are
		specified, the text is always shown to the right of the picture.
phFont		a font handle (optional)

example:

Call VisMenuSetPicture (hWndForm, hMenu, -1, hPic, 'Sample\tAlt-S')

.head 4 +  Returns
.head 5 -  Number:
.head 4 +  Parameters
.head 5 -  Window Handle: phWndForm
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: phMenu
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: pnPos
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: pnPicNormal
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: pnPicSelect
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  String: psText
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: pnColorTransparent
.head 5 +  Number: pnColorNew
.head 6 -  ! If NUMBER_Null the std 3dFace color is taken
.head 4 +  Static Variables
.head 5 -  Number: lhFontDefault
.head 4 +  Local variables
.head 5 -  String: lsFontName
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: lnFontSize
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: lnFontEnh
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: lhFont
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: lhPicEmty
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: lnPicNormal
.head 5 -  Number: lnPicSelect
.head 4 +  Actions
.head 5 +  If pnPicNormal and pnPicSelect
.head 6 -  ! Call VisMenuSetPicture(phWndForm,phMenu,pnPos,pnPicNormal,pnPicSelect, psText )
.head 6 -  Set lnPicNormal = VisPicGetHandle( pnPicNormal )
.head 6 -  Set lnPicSelect = VisPicGetHandle( pnPicSelect )
.head 6 +  If pnColorNew = NUMBER_Null
.head 7 -  Set pnColorNew = GetSysColor(COLOR_3DFACE)
.head 6 +  If pnColorTransparent != NUMBER_Null
.head 7 -  Set lnPicNormal = SalPicHandleReplaceColor(lnPicNormal, PIC_FormatBitmap, pnColorTransparent,  pnColorNew)
.head 7 -  Set lnPicSelect = SalPicHandleReplaceColor(lnPicSelect, PIC_FormatBitmap,pnColorTransparent,pnColorNew )
.head 6 -  Call SetMenuItemBitmaps( SalNumberToWindowHandle( phMenu ), pnPos, MF_BYPOSITION, lnPicNormal, lnPicSelect )
.head 3 +  Function: VisMenuPopupPicture
.head 4 -  Description: author: 	tl
date:	????
version: 	1.01 # for disabled items added
	1.00 function implemented

desc:
Creates a popupmenu by an array  with pictures
A menuseparator is marked by 3 minus
A disabled item is marked by a hash in front of the text

example:

Set wsTest[0] = 'Hallo'
Set wnPic[0] = lhPic1
Set wsTest[1] = '#Iґm disabled'
Set wnPic[1] = lhPic2
Set wsTest[2] = '---'
Set wsTest[3] = 'Hfallo'
Set wnPic[3] = lhPic3

Select Case VisMenuPopupPicture( wsTest, wnPic,TPM_CursorX,TPM_CursorY)
        Case 0
  	Break
        Case 1
  	Break
        Case 2
  	Break
        Case 3
  	Break
.head 4 +  Returns
.head 5 -  Number:
.head 4 +  Parameters
.head 5 -  String: lsEntries[*]
.head 5 -  Number: lnPic[*]
.data INHERITPROPS
0000: 0100
.enddata
.head 5 +  Number: pnX
.data INHERITPROPS
0000: 0100
.enddata
.head 6 -  ! Use the Flag TPM_CursorX for the Cursorpostion or any other X coordinate
.head 5 +  Number: pnY
.data INHERITPROPS
0000: 0100
.enddata
.head 6 -  ! Use the Flag TPM_CursorY for the Cursorpostion or any other X coordinate
.head 5 -  Number: pnColorTransparent
.head 5 +  Number: pnColorNew
.head 6 -  ! If NUMBER_Null the std 3dFace color is taken
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Window Handle: hWndMenu
.head 5 -  Number: lnXPos
.head 5 -  Number: lnYPos
.head 5 -  Number: lnMax
.head 5 -  Number: lnIdx
.head 5 -  Number: lnFlag
.head 5 -  Number: lnChoosen
.head 4 +  Actions
.head 5 -  Set hWndMenu = CreatePopupMenu(  )
.head 5 -  !
.head 5 +  If SalArrayIsEmpty( lsEntries )
.head 6 -  Return -1
.head 5 -  Call SalArrayGetUpperBound( lsEntries, 1, lnMax )
.head 5 +  While lnIdx < lnMax + 1
.head 6 +  If SalStrScan(lsEntries[lnIdx] ,'---') != -1
.head 7 -  Call InsertMenuA(  hWndMenu, 0xFFFFFFFF, MF_BYPOSITION | MF_SEPARATOR, lnIdx+1,STRING_Null)
.head 6 +  Else
.head 7 -  Set lnFlag = 0
.head 7 +  If SalStrLeftX( lsEntries[lnIdx] ,1 ) = "#"
.head 8 -  Set lnFlag = lnFlag | MF_DISABLED | MF_GRAYED
.head 8 -  Set lsEntries[lnIdx] = SalStrRightX( lsEntries[lnIdx], SalStrLength( lsEntries[lnIdx] ) -1 )
.head 7 -  Call InsertMenuA(  hWndMenu, 0xFFFFFFFF, lnFlag | MF_BYPOSITION | MF_STRING, lnIdx+1,lsEntries[lnIdx] )
.head 7 -  ! Add picture, when it is given
.head 7 +  If lnPic[lnIdx] > 0
.head 8 -  Call VisMenuSetPictureX(hWndForm, SalWindowHandleToNumber(hWndMenu),lnIdx,lnPic[lnIdx],lnPic[lnIdx],lsEntries[lnIdx], pnColorTransparent, pnColorNew )
.head 6 -  Set lnIdx = lnIdx + 1
.head 5 -  !
.head 5 -  ! !
.head 5 -  Call GetCursorPos( lnXPos, lnYPos )
.head 5 +  If pnX = TPM_CursorX
.head 6 -  Set pnX = lnXPos
.head 5 +  If pnY = TPM_CursorY
.head 6 -  Set pnY = lnYPos
.head 5 -  Set lnChoosen = (TrackPopupMenu(hWndMenu, TPM_LEFTALIGN | TPM_RETURNCMD,
pnX, pnY, 0, hWndForm, STRING_Null ))-1
.head 5 -  Call DestroyMenu(hWndMenu)
.head 5 -  Return lnChoosen
.head 3 +  Function: VisMenuPopupPictureRessource
.head 4 -  Description: author: 	tl
date:	????
version: 	1.01 # for disabled items added
	1.00 function implemented

desc:
Creates a popupmenu by an array, with pictures (bitmaps), loaded from the ressource section.
A menuseparator is marked by 3 minus
A disabled item is marked by a hash in front of the text

example:

Set wsTest[0] = 'Hallo'
Set wnPic[0] = 'bmpTest1'
Set wsTest[1] = '#Iґm disabled'
Set wnPic[1] = 'bmpTest2'
Set wsTest[2] = '---'
Set wsTest[3] = 'Hfallo'

Select Case VisMenuPopupPictureRessource( wsTest,wnPic,TPM_CursorX,TPM_CursorY)
        Case 0
  	Break
        Case 1
  	Break
        Case 2
  	Break
        Case 3
  	Break
.head 4 +  Returns
.head 5 -  Number:
.head 4 +  Parameters
.head 5 -  String: lsEntries[*]
.head 5 +  String: lsPictureRessource[*]
.data INHERITPROPS
0000: 0100
.enddata
.head 6 -  ! Only bitnmap ressource names are supported
.head 5 +  Number: pnX
.data INHERITPROPS
0000: 0100
.enddata
.head 6 -  ! Use the Flag TPM_CursorX for the Cursorpostion or any other X coordinate
.head 5 +  Number: pnY
.data INHERITPROPS
0000: 0100
.enddata
.head 6 -  ! Use the Flag TPM_CursorY for the Cursorpostion or any other X coordinate
.head 5 -  Number: pnColorTransparent
.head 5 +  Number: pnColorNew
.head 6 -  ! If NUMBER_Null the std 3dFace color is taken
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: lnMax
.head 5 -  Number: lnIdx
.head 5 -  Number: lnPicHandle[*]
.head 5 -  Number: lnResult
.data INHERITPROPS
0000: 0100
.enddata
.head 4 +  Actions
.head 5 +  If SalArrayIsEmpty( lsEntries )
.head 6 -  Return -1
.head 5 -  Call SalArrayGetUpperBound( lsEntries, 1, lnMax )
.head 5 +  While lnIdx < lnMax + 1
.head 6 +  If lsPictureRessource[lnIdx] != STRING_Null
.head 7 -  Set lnPicHandle[lnIdx] = VisPicLoad(PIC_LoadSWinRes | PIC_FormatBitmap,lsPictureRessource[lnIdx],'')
.head 6 -  Set lnIdx = lnIdx + 1
.head 5 -  Set lnResult = VisMenuPopupPicture( lsEntries, lnPicHandle,pnX,pnY ,pnColorTransparent, pnColorNew )
.head 5 -  Return lnResult
.head 3 +  Function: SalMenuSysAdd
.head 4 -  Description: author: 	???
date:
version:	V1.00

desc:
Adds an Entry to the system menu of an form window
example:

Call SalMenuSysAdd(999, 'Hallo')


On WM_SYSCOMMAND
  Select Case wParam
	Case 999
		Call ....
	Default

.head 4 -  Returns
.head 4 +  Parameters
.head 5 -  Number: pnInformCode
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  String: psText
.data INHERITPROPS
0000: 0100
.enddata
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Window Handle: hWndSysMenu
.data INHERITPROPS
0000: 0100
.enddata
.head 4 +  Actions
.head 5 -  Set hWndSysMenu = GetSystemMenu( hWndForm, FALSE )
.head 5 -  ! Call AppendMenuA( hWndSysMenu, MF_SEPARATOR, 0, '' )
.head 5 -  Call AppendMenuA( hWndSysMenu, MF_ENABLED, pnInformCode, psText )
.head 3 +  Function: SalMenuSystemEnable
.head 4 -  Description: Enables or disables the systemmenu items of a window.

phWndForm	   Window Handle
pnMenuItem	   SC_CLOSE
		   SC_RESTORE
		   SC_MINIMIZE
		   SC_MAXIMIZE
pbEnabled	   TRUE / FALSE

example:
SalMenuSystemEnable( frmMain,SC_CLOSE,FALSE )
.head 4 -  Returns
.head 4 +  Parameters
.head 5 -  Window Handle: phWndForm
.head 5 +  Number: pnMenuItem
.head 6 -  ! SC_CLOSE
SC_RESTORE
SC_MINIMIZE
SC_MAXIMIZE
.head 5 -  Boolean: pbEnabled
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: lnItemState
.head 4 +  Actions
.head 5 -  Set lnItemState =VisNumberChoose(pbEnabled,MF_ENABLED,MF_DISABLED )
.head 5 -  Call EnableMenuItem( GetSystemMenu( phWndForm, FALSE ), pnMenuItem, MF_BYCOMMAND | lnItemState )
.head 3 +  Function: SalMenuPopup
.head 4 -  Description: author: 	tl
date:	????
version: 	1.02 | for menucolumns
	1.01 # for disabled items added
	1.00 function implemented

desc:
Creates a popupmenu of an array
A menuseparator is marked by 3 minus
A menucolumn is marked by a pipe
A disabled item is marked by a hash in front of the text

example:

Set wsTest[0] = 'Hallo'
Set wsTest[1] = '#Iґm disabled'
Set wsTest[2] = '---'
Set wsTest[3] = 'Hallo'
Set wsTest[4] = '|'
Set wsTest[5] = '2 column'

Select Case SalPopupMenu( wsTest)
        Case 0
  	Break
        Case 1
  	Break
        Case 2
  	Break
        Case 3
  	Break
.head 4 +  Returns
.head 5 -  Number:
.head 4 +  Parameters
.head 5 -  String: lsEntries[*]
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Window Handle: hWndMenu
.head 5 -  Number: lnXPos
.head 5 -  Number: lnYPos
.head 5 -  Number: lnMax
.head 5 -  Number: lnIdx
.head 5 -  Number: lnFlag
.head 4 +  Actions
.head 5 -  Set hWndMenu = CreatePopupMenu(  )
.head 5 -  !
.head 5 -  Call SalArrayGetUpperBound( lsEntries, 1, lnMax )
.head 5 +  While lnIdx < lnMax + 1
.head 6 -  !
.head 6 +  If SalStrScan(lsEntries[lnIdx] ,'---') != -1
.head 7 -  Set lnFlag = MF_SEPARATOR
.head 6 -  !
.head 6 +  If SalStrScan(lsEntries[lnIdx] ,'|') != -1
.head 7 -  Set lnFlag = MF_MENUBARBREAK
.head 6 -  !
.head 6 +  Else
.head 7 +  If SalStrLeftX( lsEntries[lnIdx] ,1 ) = "#"
.head 8 -  Set lnFlag = lnFlag | MF_DISABLED | MF_GRAYED
.head 8 -  Set lsEntries[lnIdx] = SalStrRightX( lsEntries[lnIdx], SalStrLength( lsEntries[lnIdx] ) -1 )
.head 7 -  Call InsertMenuA(  hWndMenu, 0xFFFFFFFF, lnFlag | MF_BYPOSITION | MF_STRING, lnIdx+1,
lsEntries[lnIdx] )
.head 7 -  Set lnFlag = 0
.head 6 -  !
.head 6 -  Set lnIdx = lnIdx + 1
.head 5 -  !
.head 5 -  ! !
.head 5 -  Call GetCursorPos( lnXPos, lnYPos )
.head 5 -  Return (TrackPopupMenu(hWndMenu, TPM_LEFTALIGN | TPM_RETURNCMD,
lnXPos, lnYPos, 0, hWndForm, STRING_Null ))-1
.head 2 -  Named Menus
.head 2 -  Class Definitions
.head 2 +  Default Classes
.head 3 -  MDI Window: cBaseMDI
.head 3 -  Form Window:
.head 3 -  Dialog Box:
.head 3 -  Table Window:
.head 3 -  Quest Window:
.head 3 -  Data Field:
.head 3 -  Spin Field:
.head 3 -  Multiline Field:
.head 3 -  Pushbutton:
.head 3 -  Radio Button:
.head 3 -  Option Button:
.head 3 -  Check Box:
.head 3 -  Child Table:
.head 3 -  Quest Child Window: cQuickDatabase
.head 3 -  List Box:
.head 3 -  Combo Box:
.head 3 -  Picture:
.head 3 -  Vertical Scroll Bar:
.head 3 -  Horizontal Scroll Bar:
.head 3 -  Column:
.head 3 -  Background Text:
.head 3 -  Group Box:
.head 3 -  Line:
.head 3 -  Frame:
.head 3 -  Custom Control:
.head 3 -  ActiveX:
.head 2 -  Application Actions


Gupta.narod.ru - примеры программирования на Gupta Team Developer 2005 (GTD, CTD, TOM, Quest, SQLTalk, Report Builder, SQLWindows, SQLBase, Oracle, Web Developer, Team Object Manager)

Google
 

Return to http://gupta.narod.ru/


Сайт создан в системе uCoz