David,
Here's part 2 of 2, the pushButton method that uses the constants that I
declared in the previous post.
; code begins...
;|BeginMethod|#Page2.#Button3|pushButton|
uses USER
messageBox( hwOwner CWORD, ; Handle of the owner
box_Text CPTR, ; Text of the message
boxTitle CPTR, ; Text in the title
boxStyle CWORD ) CWORD ; Style of the box.
endUses
method pushButton(var eventInfo Event)
var
msgTitle String
msg_Text String
msgStyle SmallInt
pxHandle SmallInt
this_App Application
retValue SmallInt
Response String
endVar
; Begin by getting Paradox's handle
pxHandle = this_App.windowHandle()
; Initialize the text strings.
msgTitle = "Windows API MessageBox()"
msg_Text = "This dialog was created using the messageBox()\n" +
"function that's available from the Windows API."
; Setup the style of the dialog.
msgStyle = mb_iconInformation + mb_OK
; show the dialog box.
retValue = messageBox( pxHandle, msg_Text, msgTitle, msgStyle )
; Evaluate the results of the dialog
switch
case retvalue = IDOK : Response = "OK Button"
case retvalue = IDCANCEL : Response = "Cancel Button"
case retvalue = IDABORT : Response = "Abort Button"
case retvalue = IDRETRY : Response = "Retry Button"
case retvalue = IDIGNORE : Response = "Ignore Button"
case retvalue = IDYES : Response = "Yes Button"
case retvalue = IDNO : Response = "No Button"
endSwitch
Message( "You chose the " + Response + "..." )
endmethod
;|EndMethod|#Page2.#Button3|pushButton|
; end of the second code listing of two.
As you can see, it's not a difficult task. When you use this in Paradox 5.0,
curiously enough, the dialog appears in the Windows-3D style, which is
similar to the look of the PAradox dialogs and most current versions of MS's
application offerings. This stems from Paradox's used of CTL3DV2.DLL, which
provides that look for the current Borland apps.
Now, to customize this for your own use, e.g. to choose different buttons,
icons, and behavior, change the constants used to define msgStyle. For
example, setting msgStyle to:
msgStyle = mb_iconHand + mb_abortRetryIgnore
results in something similar to the msgAbortRetryIgnore() built-in procedure
of the Paradox 5.0 System type.
Hope this helps...
-- Lance
--- Maximus 2.02
---------------
* Origin: Mountain Retreat (1:216/506)
|