` Printed Icetips Article

Icetips Article



ABC: Making the No button default on deletes
1998-07-07 -- Rick Martin
 
Newsgroups: topspeed.products.c4

>       Could anyone tell me how to force the default button
>      of the Confirm Delete dialog to No.

You need to override the ErrorClass and change your application to use your
new class.
Here is the Class definition I use to accomplish the same thing.

Put this into an include file in your LibSrc directory (I use SHError.INC
and SHError.CLW):

!ABCIncludeFile

OMIT('_EndOfInclude_',_SharpeErrorPresent_)
_SharpeErrorPresent_ EQUATE(1)

 INCLUDE('aberror.inc')

SharpeError CLASS(ErrorClass),TYPE,MODULE('SHERROR.CLW'), |
            LINK('SHERROR.CLW',_ABCLinkMode_),DLL(_ABCDllMode_)
TakeUser      PROCEDURE,BYTE,VIRTUAL,PROC,PROTECTED
            END

_EndOfInclude_

Put this code in a source file in your LibSrc

  MEMBER

  MAP
  .

  INCLUDE('SHERROR.INC')


! We want to override Take user and make No the default for confirm delete
SharpeError.TakeUser PROCEDURE
  CODE
    If Self.Errors.ID = Msg:ConfirmDelete
      IF MESSAGE(Self.SubsString(),Self.Errors.Title,ICON:Question, |
         Button:Yes+Button:No,BUTTON:No,0) = Button:Yes
        RETURN Level:Benign
      ELSE
        RETURN Level:Cancel
      END
    Else
      Return Parent.TakeUser()
    End

HTH,
Rick



Printed November 23, 2024, 8:14 pm
This article has been viewed/printed 35385 times.
Google search has resulted in 14 hits on this article since January 25, 2004.