Alaska Software Inc. - Can't Destroy the Pushbuttons In Hybrid Application
Username: Password:
AuthorTopic: Can't Destroy the Pushbuttons In Hybrid Application
Carmelo RiofloridoCan't Destroy the Pushbuttons In Hybrid Application
on Sat, 25 Nov 2006 14:32:50 -0800
When I call the attached Alaska sample program from my hybrid application,
the Pushbuttons would not get destroyed and show on top of my application
screens. If I click on the Exit button the second time, then it makes my
application terminates.

What modification shall I do to extinguish the pushbuttons when I go back to
my application?  Please help.

Thanks,
Carmelo




//////////////////////////////////////////////////////////////////////

  DBGET2.PRG
  Copyright:
      Alaska Software, (c) 1997-2003. All rights reserved.
  Contents:
      Standard Get screen for a database combined with pushbuttons.

      This file must be linked in windows mode (/SUBSYSTEM:WINDOWS
      or /PM:PM) since it uses graphical pushbutton objects.

//////////////////////////////////////////////////////////////////////

#include "Getexit.ch"
#include "AppEvent.ch"
#include "SetCurs.ch"

/*
 * Position and height for pushbuttons.
 */
#define B_TOP     90
#define B_HEIGHT  30

****************
PROCEDURE Main()

   LOCAL GetList:={}, lExit

   SetMouse(.T.)
   SetCursor( SC_NORMAL )
   SetAppWindow():AutoFocus := .F.
   SetAppWindow():AutoMark  := .F.

   SET DEFAULT TO "..\..\DATA"
   USE dgetcust EXCLUSIVE
   SET DELETED ON
   GO TOP

   SET SCOREBOARD OFF

   SetColor( "N/W, W+/B, B/W, R/W, W+/N" )
   CLS

   @  0, 0 TO 24,79 DOUBLE
   /*
    * Creation of the GET mask
    */
   @  0, 1 SAY PADC(" Change Customer ", 76, CHR(205))

   @  1, 1 TO 8,78
   @  2, 7 SAY "c/o:"         GET  MR_MRS
   @  2,14 SAY "(1=Mr. 2=Mrs. 3=Miss 4=Sirs)"

   @  3, 5 SAY "Name1:"       GET  NAME1
   @  4, 5 SAY "Name2:"       GET  NAME2
   @  5, 4 SAY "Street:"      GET  STREET
   @  6, 7 SAY "Zip:"         GET  ZIP
   @  7, 6 SAY "City:"        GET  CITY
   @  2,53 SAY "CustNo:"      GET  CUSTNO
   @  3,54 SAY "Phone:"       GET  PHONE
   @  4,56 SAY "Fax:"         GET  FAX
   @  6,49 SAY "BusinessID:"  GET  BUSINESSID
   @  9, 1 TO 13,78
   @ 10, 3 SAY "Remarks:"     GET  REMARK1
   @ 11,12                    GET  REMARK2
   @ 12,12                    GET  REMARK3

   @ 14, 1 TO 16,78
   @ 15, 5 SAY "First:"       GET  FIRSTDATE
   @ 15,23 SAY "Last:"        GET  LASTDATE
   @ 15,39 SAY "Responsible:" GET  KEYPERSON

   /*
    * Create pushbuttons (they are automatically added to the
    * child list of the current SetAppWindow() object -> XbpCrt window)
    */
   PushButton ( { 25, B_TOP }, { 50, B_HEIGHT }, "Help",      ;
                       {|| GetHelp() } )

   PushButton ( { 120, B_TOP }, { 50, B_HEIGHT }, "Next",     ;
                {|| GetUpdate(), DbSkip(1), GetRefresh(GetList) } )

   PushButton ( { 220, B_TOP }, { 80, B_HEIGHT }, "Previous", ;
                {|| GetUpdate(), DbSkip(-1), GetRefresh(GetList) } )

   PushButton ( { 340, B_TOP }, { 50, B_HEIGHT }, "New",      ;
                {|| GetUpdate(), DbAppend(), GetRefresh(GetList) } )

   PushButton ( { 430, B_TOP }, { 70, B_HEIGHT }, "Delete",   ;
                {|| GetUpdate(), DbDelete(), GetRefresh(GetList) } )

   PushButton ( { 540, B_TOP }, { 50, B_HEIGHT }, "Exit",     ;
                {|| PostAppEvent ( xbeP_Close ) } )
   @ 20, 0 SAY "" + Replicate("", 78) + ""

   ColorSelect(3)
   @ 21, 9 SAY "Simple Get entry screen programmed in procedural style
using"
   @ 23, 9 SAY "@ SAY...GET and graphical Pushbuttons (Xbase++ hybrid mode)"
   ColorSelect(0)

   lExit := .F.

   DO WHILE ! lExit
      READ SAVE
      IF LastAppEvent() == xbeK_PGDN
         DBSKIP(1)
      ELSEIF LastAppEvent() == xbeK_PGUP
         DBSKIP(-1)
      ELSEIF LastAppEvent() == xbeP_Close
         /*
           The user has closed the window via system menu and
           READ SAVE was terminated. This terminates the program, too.
          */
         AppQuit()
      ENDIF
      GetRefresh(GetList)
   ENDDO

RETURN

*******************
PROCEDURE AppQuit()
  CLOSE ALL
  QUIT
RETURN

*******************
PROCEDURE GetHelp()

   LOCAL cScreen, nRow := Row(), nCol := Col()

   AEval( SetAppWindow():ChildList(), {|o| o:hide() } )
   SetAppFocus ( SetAppWindow() )

   SET CURSOR OFF

   cScreen := SaveScreen(0,0,MaxRow(),MaxCol())
   CLS
   ?
   ? "This is assumed to be a Help-Screen"
   ?
   ? "The current field is:", READVAR()
   ?
   WAIT

   RestScreen(0,0,MaxRow(),MaxCol(),cScreen)

   AEVAL( SetAppWindow():ChildList(), {|o| o:show() } )

   SetPos( nRow, nCol )

   SET CURSOR ON

RETURN

*******************************
PROCEDURE GetRefresh( GetList )
   LOCAL i, imax := Len(GetList)
   LOCAL oGet, nRow := Row(), nCol := Col()

   SET CURSOR OFF

   FOR i:=1 TO imax
      oGet := GetList[i]
      oGet:updateBuffer()
   NEXT
   SET CURSOR ON
   SetPos( nRow, nCol )

RETURN

*******************************
FUNCTION GetUpdate()

  /*
   * If the text buffer of the current GET object has changed, the
    buffer must be saved and the current GET object must loose its
    input focus.
   */
   IF GetActive():changed
      RETURN GetKillActive()
   ENDIF

RETURN NIL

/*
  Create new XbpPushButton object in current XbpCRT window and
  set default values.
 */
FUNCTION PushButton ( aPos, aSize, xCaption, bBlock )

   LOCAL button

   button := XbpPushButton():New ( NIL, NIL, aPos, aSize )
   /*
    * Assign caption (String or resource ID of bitmap)
    */
   button:Caption  := xCaption
   /*
    * The button does not receive keyboard focus.
    */
   button:PointerFocus := .F.
   /*
    * The button is not visible immediately after :create()
    */
   button:Visible      := .F.
   /*
    * Assign activate code block.
    */
   button:Activate := bBlock
   /*
    * Create button (request system resources)
    */
   button:Create ()

   /*
    * Change Font.
    */
   button:SetFontCompoundName("10.Helv")
   /*
    * Display button with new font.
    */
   button:Show ()

RETURN button
Toni KlammerRe: Can't Destroy the Pushbuttons In Hybrid Application
on Sun, 26 Nov 2006 17:04:50 +0100
Hoi Carmelo,

The function PushButton() returns a refence to the object of the created 
pushbutton.
What you actually have to do is not just call the function, but catch the 
returned object.

So for instance use
    oPushNext := PushButton ( { 120, B_TOP }, { 50, B_HEIGHT }, "Next", {|| 
GetUpdate(), DbSkip(1), GetRefresh(GetList) } )

The var oPushNext now contains a reference to the pushbutton and can be used 
to Destroy() the object,
just by calling oPushNext:Destroy().

You can also use the var to do other things with the object like for 
instance Hide or Show the pushbutton.
This is to be done by calling oPushNext:Hide() respectively 
oPushNext:Show().

Good luck


Toni Klammer



"Carmelo Rioflorido" <unisoft@cox.net> schreef in bericht 
news:4c16cebf$102d943c$e6f12@news.alaska-software.com...
> When I call the attached Alaska sample program from my hybrid application,
> the Pushbuttons would not get destroyed and show on top of my application
> screens. If I click on the Exit button the second time, then it makes my
> application terminates.
>
> What modification shall I do to extinguish the pushbuttons when I go back 
> to
> my application?  Please help.
>
> Thanks,
> Carmelo
>
>
>
>
> //////////////////////////////////////////////////////////////////////
> 
>   DBGET2.PRG
>   Copyright:
>       Alaska Software, (c) 1997-2003. All rights reserved.
>   Contents:
>       Standard Get screen for a database combined with pushbuttons.
> 
>       This file must be linked in windows mode (/SUBSYSTEM:WINDOWS
>       or /PM:PM) since it uses graphical pushbutton objects.
> 
> //////////////////////////////////////////////////////////////////////
>
> #include "Getexit.ch"
> #include "AppEvent.ch"
> #include "SetCurs.ch"
>
> /*
> * Position and height for pushbuttons.
> */
> #define B_TOP     90
> #define B_HEIGHT  30
>
> ****************
> PROCEDURE Main()
>
>   LOCAL GetList:={}, lExit
>
>   SetMouse(.T.)
>   SetCursor( SC_NORMAL )
>   SetAppWindow():AutoFocus := .F.
>   SetAppWindow():AutoMark  := .F.
>
>   SET DEFAULT TO "..\..\DATA"
>   USE dgetcust EXCLUSIVE
>   SET DELETED ON
>   GO TOP
>
>   SET SCOREBOARD OFF
>
>   SetColor( "N/W, W+/B, B/W, R/W, W+/N" )
>   CLS
>
>   @  0, 0 TO 24,79 DOUBLE
>   /*
>    * Creation of the GET mask
>    */
>   @  0, 1 SAY PADC(" Change Customer ", 76, CHR(205))
>
>   @  1, 1 TO 8,78
>   @  2, 7 SAY "c/o:"         GET  MR_MRS
>   @  2,14 SAY "(1=Mr. 2=Mrs. 3=Miss 4=Sirs)"
>
>   @  3, 5 SAY "Name1:"       GET  NAME1
>   @  4, 5 SAY "Name2:"       GET  NAME2
>   @  5, 4 SAY "Street:"      GET  STREET
>   @  6, 7 SAY "Zip:"         GET  ZIP
>   @  7, 6 SAY "City:"        GET  CITY
>   @  2,53 SAY "CustNo:"      GET  CUSTNO
>   @  3,54 SAY "Phone:"       GET  PHONE
>   @  4,56 SAY "Fax:"         GET  FAX
>   @  6,49 SAY "BusinessID:"  GET  BUSINESSID
>   @  9, 1 TO 13,78
>   @ 10, 3 SAY "Remarks:"     GET  REMARK1
>   @ 11,12                    GET  REMARK2
>   @ 12,12                    GET  REMARK3
>
>   @ 14, 1 TO 16,78
>   @ 15, 5 SAY "First:"       GET  FIRSTDATE
>   @ 15,23 SAY "Last:"        GET  LASTDATE
>   @ 15,39 SAY "Responsible:" GET  KEYPERSON
>
>   /*
>    * Create pushbuttons (they are automatically added to the
>    * child list of the current SetAppWindow() object -> XbpCrt window)
>    */
>   PushButton ( { 25, B_TOP }, { 50, B_HEIGHT }, "Help",      ;
>                       {|| GetHelp() } )
>
>   PushButton ( { 120, B_TOP }, { 50, B_HEIGHT }, "Next",     ;
>                {|| GetUpdate(), DbSkip(1), GetRefresh(GetList) } )
>
>   PushButton ( { 220, B_TOP }, { 80, B_HEIGHT }, "Previous", ;
>                {|| GetUpdate(), DbSkip(-1), GetRefresh(GetList) } )
>
>   PushButton ( { 340, B_TOP }, { 50, B_HEIGHT }, "New",      ;
>                {|| GetUpdate(), DbAppend(), GetRefresh(GetList) } )
>
>   PushButton ( { 430, B_TOP }, { 70, B_HEIGHT }, "Delete",   ;
>                {|| GetUpdate(), DbDelete(), GetRefresh(GetList) } )
>
>   PushButton ( { 540, B_TOP }, { 50, B_HEIGHT }, "Exit",     ;
>                {|| PostAppEvent ( xbeP_Close ) } )
>   @ 20, 0 SAY "" + Replicate("", 78) + ""
>
>   ColorSelect(3)
>   @ 21, 9 SAY "Simple Get entry screen programmed in procedural style
> using"
>   @ 23, 9 SAY "@ SAY...GET and graphical Pushbuttons (Xbase++ hybrid 
> mode)"
>   ColorSelect(0)
>
>   lExit := .F.
>
>   DO WHILE ! lExit
>      READ SAVE
>      IF LastAppEvent() == xbeK_PGDN
>         DBSKIP(1)
>      ELSEIF LastAppEvent() == xbeK_PGUP
>         DBSKIP(-1)
>      ELSEIF LastAppEvent() == xbeP_Close
>         /*
>          * The user has closed the window via system menu and
>          * READ SAVE was terminated. This terminates the program, too.
>          */
>         AppQuit()
>      ENDIF
>      GetRefresh(GetList)
>   ENDDO
>
> RETURN
>
> *******************
> PROCEDURE AppQuit()
>  CLOSE ALL
>  QUIT
> RETURN
>
> *******************
> PROCEDURE GetHelp()
>
>   LOCAL cScreen, nRow := Row(), nCol := Col()
>
>   AEval( SetAppWindow():ChildList(), {|o| o:hide() } )
>   SetAppFocus ( SetAppWindow() )
>
>   SET CURSOR OFF
>
>   cScreen := SaveScreen(0,0,MaxRow(),MaxCol())
>   CLS
>   ?
>   ? "This is assumed to be a Help-Screen"
>   ?
>   ? "The current field is:", READVAR()
>   ?
>   WAIT
>
>   RestScreen(0,0,MaxRow(),MaxCol(),cScreen)
>
>   AEVAL( SetAppWindow():ChildList(), {|o| o:show() } )
>
>   SetPos( nRow, nCol )
>
>   SET CURSOR ON
>
> RETURN
>
> *******************************
> PROCEDURE GetRefresh( GetList )
>   LOCAL i, imax := Len(GetList)
>   LOCAL oGet, nRow := Row(), nCol := Col()
>
>   SET CURSOR OFF
>
>   FOR i:=1 TO imax
>      oGet := GetList[i]
>      oGet:updateBuffer()
>   NEXT
>   SET CURSOR ON
>   SetPos( nRow, nCol )
>
> RETURN
>
> *******************************
> FUNCTION GetUpdate()
>
>  /*
>   * If the text buffer of the current GET object has changed, the
>   * buffer must be saved and the current GET object must loose its
>   * input focus.
>   */
>   IF GetActive():changed
>      RETURN GetKillActive()
>   ENDIF
>
> RETURN NIL
>
> /*
> * Create new XbpPushButton object in current XbpCRT window and
> * set default values.
> */
> FUNCTION PushButton ( aPos, aSize, xCaption, bBlock )
>
>   LOCAL button
>
>   button := XbpPushButton():New ( NIL, NIL, aPos, aSize )
>   /*
>    * Assign caption (String or resource ID of bitmap)
>    */
>   button:Caption  := xCaption
>   /*
>    * The button does not receive keyboard focus.
>    */
>   button:PointerFocus := .F.
>   /*
>    * The button is not visible immediately after :create()
>    */
>   button:Visible      := .F.
>   /*
>    * Assign activate code block.
>    */
>   button:Activate := bBlock
>   /*
>    * Create button (request system resources)
>    */
>   button:Create ()
>
>   /*
>    * Change Font.
>    */
>   button:SetFontCompoundName("10.Helv")
>   /*
>    * Display button with new font.
>    */
>   button:Show ()
>
> RETURN button
>
>
>
>
Carmelo RiofloridoRe: Can't Destroy the Pushbuttons In Hybrid Application
on Mon, 27 Nov 2006 19:37:56 -0800
Hi Toni,

I tried your suggestions by modifying the program as shown below. However,
the problem of not being able to destroy the pushbuttons still exists.

What did I miss?

Thank you again.

Carmelo M. Rioflorido

**************
local oPushNext, oPushHelp.... etc..
......

  * Create pushbuttons (they are automatically added to the
    * child list of the current SetAppWindow() object -> XbpCrt window)
    */

   PushButton ( { 25, B_TOP }, { 50, B_HEIGHT }, "Help",      ;
                       {|| GetHelp() } )

   PushButton ( { 120, B_TOP }, { 50, B_HEIGHT }, "Next",     ;
                {|| GetUpdate(), DbSkip(1), GetRefresh(GetList) } )

   PushButton ( { 220, B_TOP }, { 80, B_HEIGHT }, "Previous", ;
                {|| GetUpdate(), DbSkip(-1), GetRefresh(GetList) } )

   PushButton ( { 340, B_TOP }, { 50, B_HEIGHT }, "New",      ;
                {|| GetUpdate(), DbAppend(), GetRefresh(GetList) } )

   PushButton ( { 430, B_TOP }, { 70, B_HEIGHT }, "Delete",   ;
                {|| GetUpdate(), DbDelete(), GetRefresh(GetList) } )

   PushButton ( { 540, B_TOP }, { 50, B_HEIGHT }, "Exit",     ;
                {|| PostAppEvent ( xbeP_Close ) } )


   oPushHelp := PushButton ( { 25, B_TOP }, { 50, B_HEIGHT }, "Help",      ;
                       {|| GetHelp() } )

   oPushNext := PushButton ( { 120, B_TOP }, { 50, B_HEIGHT }, "Next",     ;
                {|| GetUpdate(), DbSkip(1), GetRefresh(GetList) } )

   oPushPrev := PushButton ( { 220, B_TOP }, { 80, B_HEIGHT }, "Previous", ;
                {|| GetUpdate(), DbSkip(-1), GetRefresh(GetList) } )

   oPushNew := PushButton ( { 340, B_TOP }, { 50, B_HEIGHT }, "New",      ;
                {|| GetUpdate(), DbAppend(), GetRefresh(GetList) } )

   oPushDelete := PushButton ( { 430, B_TOP }, { 70, B_HEIGHT }, "Delete",
;
                {|| GetUpdate(), DbDelete(), GetRefresh(GetList) } )

   oPushExit := PushButton ( { 540, B_TOP }, { 50, B_HEIGHT }, "Exit",     ;
                {|| PostAppEvent ( xbeP_Close ) } )

   lExit := .F.

   DO WHILE ! lExit
      READ SAVE
      IF LastAppEvent() == xbeK_PGDN
         DBSKIP(1)
      ELSEIF LastAppEvent() == xbeK_PGUP
         DBSKIP(-1)
      ELSEIF LastAppEvent() == xbeP_Close

           oPushNext:Destroy()
           oPushHelp:Destroy()
           oPushPrev:Destroy()
           oPushExit:Destroy()
           oPushNew:Destroy()
           oPushDelete:Destroy()

         db_AppQuit()
         exit
      ENDIF
      GetRefresh(GetList)
   ENDDO

RETURN





"Toni Klammer" <info@weerterhof.nl> wrote in message
news:27bbf65$4ba9be94$ea71c@news.alaska-software.com...
> Hoi Carmelo,
>
> The function PushButton() returns a refence to the object of the created
> pushbutton.
> What you actually have to do is not just call the function, but catch the
> returned object.
>
> So for instance use
>     oPushNext := PushButton ( { 120, B_TOP }, { 50, B_HEIGHT }, "Next",
{||
> GetUpdate(), DbSkip(1), GetRefresh(GetList) } )
>
> The var oPushNext now contains a reference to the pushbutton and can be
used
> to Destroy() the object,
> just by calling oPushNext:Destroy().
>
> You can also use the var to do other things with the object like for
> instance Hide or Show the pushbutton.
> This is to be done by calling oPushNext:Hide() respectively
> oPushNext:Show().
>
> Good luck
>
>
> Toni Klammer
>
>
>
> "Carmelo Rioflorido" <unisoft@cox.net> schreef in bericht
> news:4c16cebf$102d943c$e6f12@news.alaska-software.com...
> > When I call the attached Alaska sample program from my hybrid
application,
> > the Pushbuttons would not get destroyed and show on top of my
application
> > screens. If I click on the Exit button the second time, then it makes my
> > application terminates.
> >
> > What modification shall I do to extinguish the pushbuttons when I go
back
> > to
> > my application?  Please help.
> >
> > Thanks,
> > Carmelo
> >
> >
> >
> >
> > //////////////////////////////////////////////////////////////////////
> > 
> >   DBGET2.PRG
> >   Copyright:
> >       Alaska Software, (c) 1997-2003. All rights reserved.
> >   Contents:
> >       Standard Get screen for a database combined with pushbuttons.
> > 
> >       This file must be linked in windows mode (/SUBSYSTEM:WINDOWS
> >       or /PM:PM) since it uses graphical pushbutton objects.
> > 
> > //////////////////////////////////////////////////////////////////////
> >
> > #include "Getexit.ch"
> > #include "AppEvent.ch"
> > #include "SetCurs.ch"
> >
> > /*
> > * Position and height for pushbuttons.
> > */
> > #define B_TOP     90
> > #define B_HEIGHT  30
> >
> > ****************
> > PROCEDURE Main()
> >
> >   LOCAL GetList:={}, lExit
> >
> >   SetMouse(.T.)
> >   SetCursor( SC_NORMAL )
> >   SetAppWindow():AutoFocus := .F.
> >   SetAppWindow():AutoMark  := .F.
> >
> >   SET DEFAULT TO "..\..\DATA"
> >   USE dgetcust EXCLUSIVE
> >   SET DELETED ON
> >   GO TOP
> >
> >   SET SCOREBOARD OFF
> >
> >   SetColor( "N/W, W+/B, B/W, R/W, W+/N" )
> >   CLS
> >
> >   @  0, 0 TO 24,79 DOUBLE
> >   /*
> >    * Creation of the GET mask
> >    */
> >   @  0, 1 SAY PADC(" Change Customer ", 76, CHR(205))
> >
> >   @  1, 1 TO 8,78
> >   @  2, 7 SAY "c/o:"         GET  MR_MRS
> >   @  2,14 SAY "(1=Mr. 2=Mrs. 3=Miss 4=Sirs)"
> >
> >   @  3, 5 SAY "Name1:"       GET  NAME1
> >   @  4, 5 SAY "Name2:"       GET  NAME2
> >   @  5, 4 SAY "Street:"      GET  STREET
> >   @  6, 7 SAY "Zip:"         GET  ZIP
> >   @  7, 6 SAY "City:"        GET  CITY
> >   @  2,53 SAY "CustNo:"      GET  CUSTNO
> >   @  3,54 SAY "Phone:"       GET  PHONE
> >   @  4,56 SAY "Fax:"         GET  FAX
> >   @  6,49 SAY "BusinessID:"  GET  BUSINESSID
> >   @  9, 1 TO 13,78
> >   @ 10, 3 SAY "Remarks:"     GET  REMARK1
> >   @ 11,12                    GET  REMARK2
> >   @ 12,12                    GET  REMARK3
> >
> >   @ 14, 1 TO 16,78
> >   @ 15, 5 SAY "First:"       GET  FIRSTDATE
> >   @ 15,23 SAY "Last:"        GET  LASTDATE
> >   @ 15,39 SAY "Responsible:" GET  KEYPERSON
> >
> >   /*
> >    * Create pushbuttons (they are automatically added to the
> >    * child list of the current SetAppWindow() object -> XbpCrt window)
> >    */
> >   PushButton ( { 25, B_TOP }, { 50, B_HEIGHT }, "Help",      ;
> >                       {|| GetHelp() } )
> >
> >   PushButton ( { 120, B_TOP }, { 50, B_HEIGHT }, "Next",     ;
> >                {|| GetUpdate(), DbSkip(1), GetRefresh(GetList) } )
> >
> >   PushButton ( { 220, B_TOP }, { 80, B_HEIGHT }, "Previous", ;
> >                {|| GetUpdate(), DbSkip(-1), GetRefresh(GetList) } )
> >
> >   PushButton ( { 340, B_TOP }, { 50, B_HEIGHT }, "New",      ;
> >                {|| GetUpdate(), DbAppend(), GetRefresh(GetList) } )
> >
> >   PushButton ( { 430, B_TOP }, { 70, B_HEIGHT }, "Delete",   ;
> >                {|| GetUpdate(), DbDelete(), GetRefresh(GetList) } )
> >
> >   PushButton ( { 540, B_TOP }, { 50, B_HEIGHT }, "Exit",     ;
> >                {|| PostAppEvent ( xbeP_Close ) } )
> >   @ 20, 0 SAY "" + Replicate("", 78) + ""
> >
> >   ColorSelect(3)
> >   @ 21, 9 SAY "Simple Get entry screen programmed in procedural style
> > using"
> >   @ 23, 9 SAY "@ SAY...GET and graphical Pushbuttons (Xbase++ hybrid
> > mode)"
> >   ColorSelect(0)
> >
> >   lExit := .F.
> >
> >   DO WHILE ! lExit
> >      READ SAVE
> >      IF LastAppEvent() == xbeK_PGDN
> >         DBSKIP(1)
> >      ELSEIF LastAppEvent() == xbeK_PGUP
> >         DBSKIP(-1)
> >      ELSEIF LastAppEvent() == xbeP_Close
> >         /*
> >          * The user has closed the window via system menu and
> >          * READ SAVE was terminated. This terminates the program, too.
> >          */
> >         AppQuit()
> >      ENDIF
> >      GetRefresh(GetList)
> >   ENDDO
> >
> > RETURN
> >
> > *******************
> > PROCEDURE AppQuit()
> >  CLOSE ALL
> >  QUIT
> > RETURN
> >
> > *******************
> > PROCEDURE GetHelp()
> >
> >   LOCAL cScreen, nRow := Row(), nCol := Col()
> >
> >   AEval( SetAppWindow():ChildList(), {|o| o:hide() } )
> >   SetAppFocus ( SetAppWindow() )
> >
> >   SET CURSOR OFF
> >
> >   cScreen := SaveScreen(0,0,MaxRow(),MaxCol())
> >   CLS
> >   ?
> >   ? "This is assumed to be a Help-Screen"
> >   ?
> >   ? "The current field is:", READVAR()
> >   ?
> >   WAIT
> >
> >   RestScreen(0,0,MaxRow(),MaxCol(),cScreen)
> >
> >   AEVAL( SetAppWindow():ChildList(), {|o| o:show() } )
> >
> >   SetPos( nRow, nCol )
> >
> >   SET CURSOR ON
> >
> > RETURN
> >
> > *******************************
> > PROCEDURE GetRefresh( GetList )
> >   LOCAL i, imax := Len(GetList)
> >   LOCAL oGet, nRow := Row(), nCol := Col()
> >
> >   SET CURSOR OFF
> >
> >   FOR i:=1 TO imax
> >      oGet := GetList[i]
> >      oGet:updateBuffer()
> >   NEXT
> >   SET CURSOR ON
> >   SetPos( nRow, nCol )
> >
> > RETURN
> >
> > *******************************
> > FUNCTION GetUpdate()
> >
> >  /*
> >   * If the text buffer of the current GET object has changed, the
> >   * buffer must be saved and the current GET object must loose its
> >   * input focus.
> >   */
> >   IF GetActive():changed
> >      RETURN GetKillActive()
> >   ENDIF
> >
> > RETURN NIL
> >
> > /*
> > * Create new XbpPushButton object in current XbpCRT window and
> > * set default values.
> > */
> > FUNCTION PushButton ( aPos, aSize, xCaption, bBlock )
> >
> >   LOCAL button
> >
> >   button := XbpPushButton():New ( NIL, NIL, aPos, aSize )
> >   /*
> >    * Assign caption (String or resource ID of bitmap)
> >    */
> >   button:Caption  := xCaption
> >   /*
> >    * The button does not receive keyboard focus.
> >    */
> >   button:PointerFocus := .F.
> >   /*
> >    * The button is not visible immediately after :create()
> >    */
> >   button:Visible      := .F.
> >   /*
> >    * Assign activate code block.
> >    */
> >   button:Activate := bBlock
> >   /*
> >    * Create button (request system resources)
> >    */
> >   button:Create ()
> >
> >   /*
> >    * Change Font.
> >    */
> >   button:SetFontCompoundName("10.Helv")
> >   /*
> >    * Display button with new font.
> >    */
> >   button:Show ()
> >
> > RETURN button
> >
> >
> >
> >
>
>
AUGE_OHRRe: Can't Destroy the Pushbuttons In Hybrid Application
on Tue, 28 Nov 2006 05:11:50 +0100
hi,

>   oPushExit := PushButton ( { 540, B_TOP }, { 50, B_HEIGHT }, "Exit",
> ;
>                {|| PostAppEvent ( xbeP_Close ) } )
>   lExit := .F.
>   DO WHILE ! lExit
>      READ SAVE
>      IF LastAppEvent() == xbeK_PGDN
>         DBSKIP(1)
>      ELSEIF LastAppEvent() == xbeK_PGUP
>         DBSKIP(-1)
>      ELSEIF LastAppEvent() == xbeP_Close

try to change xbeP_Close into xbeK_xxx

greetings by OHR
Jimmy
Carmelo RiofloridoRe: Can't Destroy the Pushbuttons In Hybrid Application
on Mon, 27 Nov 2006 21:40:45 -0800
Hi Jimmy,

I tried your suggestion and the error message says "undefined variable
xbeK_xxx".
Do I need to define or declare xbeK_xxx somewhere?

Thanks,
Carmelo

*****************
"AUGE_OHR" <AUGE_OHR*AT*CSI.COM> wrote in message
news:56f5dc48$504a2c65$fa7a3@news.alaska-software.com...
> hi,
>
> >   oPushExit := PushButton ( { 540, B_TOP }, { 50, B_HEIGHT }, "Exit",
> > ;
> >                {|| PostAppEvent ( xbeP_Close ) } )
> >   lExit := .F.
> >   DO WHILE ! lExit
> >      READ SAVE
> >      IF LastAppEvent() == xbeK_PGDN
> >         DBSKIP(1)
> >      ELSEIF LastAppEvent() == xbeK_PGUP
> >         DBSKIP(-1)
> >      ELSEIF LastAppEvent() == xbeP_Close
>
> try to change xbeP_Close into xbeK_xxx
>
> greetings by OHR
> Jimmy
>
>
AUGE_OHRRe: Can't Destroy the Pushbuttons In Hybrid Application
on Tue, 28 Nov 2006 08:35:36 +0100
hi,

> I tried your suggestion and the error message says "undefined variable
> xbeK_xxx".
> Do I need to define or declare xbeK_xxx somewhere?

i meen "xbeK_", where "K_" is "Keyboard", like xbeK_F1
you find these in  C:\ALASKA\XPPW32\INCLUDE\appevent.ch

greetings by OHR
Jimmy
Toni KlammerRe: Can't Destroy the Pushbuttons In Hybrid Application
on Tue, 28 Nov 2006 10:13:27 +0100
What I see in your code is that you first call PushButton without capturing 
the result in a Var.
Later you call the same function but now you correctly save the result in a 
Var.
In this state you actualy have two of every button, later on destroying the 
second one(s),
but the first button still is not destroyed and (therefor) still visible.

If you define objects without capturing the reference to that object, you 
can't do anything else with the object,
so you cannot Hide nor Destroy it. So keep in mind to capture the reference 
to the object in a Var and from that moment
on, use the Var (that actually contains a reference to the object involved) 
to change the objects behaviour.

Good luck


Toni

"Carmelo Rioflorido" <unisoft@cox.net> schreef in bericht 
news:27a79ac4$5d087838$fa7de@news.alaska-software.com...
> Hi Toni,
>
> I tried your suggestions by modifying the program as shown below. However,
> the problem of not being able to destroy the pushbuttons still exists.
>
> What did I miss?
>
> Thank you again.
>
> Carmelo M. Rioflorido
>
> **************
> local oPushNext, oPushHelp.... etc..
> ......
>
>  * Create pushbuttons (they are automatically added to the
>    * child list of the current SetAppWindow() object -> XbpCrt window)
>    */
>
>   PushButton ( { 25, B_TOP }, { 50, B_HEIGHT }, "Help",      ;
>                       {|| GetHelp() } )
>
>   PushButton ( { 120, B_TOP }, { 50, B_HEIGHT }, "Next",     ;
>                {|| GetUpdate(), DbSkip(1), GetRefresh(GetList) } )
>
>   PushButton ( { 220, B_TOP }, { 80, B_HEIGHT }, "Previous", ;
>                {|| GetUpdate(), DbSkip(-1), GetRefresh(GetList) } )
>
>   PushButton ( { 340, B_TOP }, { 50, B_HEIGHT }, "New",      ;
>                {|| GetUpdate(), DbAppend(), GetRefresh(GetList) } )
>
>   PushButton ( { 430, B_TOP }, { 70, B_HEIGHT }, "Delete",   ;
>                {|| GetUpdate(), DbDelete(), GetRefresh(GetList) } )
>
>   PushButton ( { 540, B_TOP }, { 50, B_HEIGHT }, "Exit",     ;
>                {|| PostAppEvent ( xbeP_Close ) } )
>
>
>   oPushHelp := PushButton ( { 25, B_TOP }, { 50, B_HEIGHT }, "Help", 
> ;
>                       {|| GetHelp() } )
>
>   oPushNext := PushButton ( { 120, B_TOP }, { 50, B_HEIGHT }, "Next", 
> ;
>                {|| GetUpdate(), DbSkip(1), GetRefresh(GetList) } )
>
>   oPushPrev := PushButton ( { 220, B_TOP }, { 80, B_HEIGHT }, "Previous", 
> ;
>                {|| GetUpdate(), DbSkip(-1), GetRefresh(GetList) } )
>
>   oPushNew := PushButton ( { 340, B_TOP }, { 50, B_HEIGHT }, "New",      ;
>                {|| GetUpdate(), DbAppend(), GetRefresh(GetList) } )
>
>   oPushDelete := PushButton ( { 430, B_TOP }, { 70, B_HEIGHT }, "Delete",
> ;
>                {|| GetUpdate(), DbDelete(), GetRefresh(GetList) } )
>
>   oPushExit := PushButton ( { 540, B_TOP }, { 50, B_HEIGHT }, "Exit", 
> ;
>                {|| PostAppEvent ( xbeP_Close ) } )
>
>   lExit := .F.
>
>   DO WHILE ! lExit
>      READ SAVE
>      IF LastAppEvent() == xbeK_PGDN
>         DBSKIP(1)
>      ELSEIF LastAppEvent() == xbeK_PGUP
>         DBSKIP(-1)
>      ELSEIF LastAppEvent() == xbeP_Close
>
>           oPushNext:Destroy()
>           oPushHelp:Destroy()
>           oPushPrev:Destroy()
>           oPushExit:Destroy()
>           oPushNew:Destroy()
>           oPushDelete:Destroy()
>
>         db_AppQuit()
>         exit
>      ENDIF
>      GetRefresh(GetList)
>   ENDDO
>
> RETURN
>
>
>
>
>
> "Toni Klammer" <info@weerterhof.nl> wrote in message
> news:27bbf65$4ba9be94$ea71c@news.alaska-software.com...
>> Hoi Carmelo,
>>
>> The function PushButton() returns a refence to the object of the created
>> pushbutton.
>> What you actually have to do is not just call the function, but catch the
>> returned object.
>>
>> So for instance use
>>     oPushNext := PushButton ( { 120, B_TOP }, { 50, B_HEIGHT }, "Next",
> {||
>> GetUpdate(), DbSkip(1), GetRefresh(GetList) } )
>>
>> The var oPushNext now contains a reference to the pushbutton and can be
> used
>> to Destroy() the object,
>> just by calling oPushNext:Destroy().
>>
>> You can also use the var to do other things with the object like for
>> instance Hide or Show the pushbutton.
>> This is to be done by calling oPushNext:Hide() respectively
>> oPushNext:Show().
>>
>> Good luck
>>
>>
>> Toni Klammer
>>
>>
>>
>> "Carmelo Rioflorido" <unisoft@cox.net> schreef in bericht
>> news:4c16cebf$102d943c$e6f12@news.alaska-software.com...
>> > When I call the attached Alaska sample program from my hybrid
> application,
>> > the Pushbuttons would not get destroyed and show on top of my
> application
>> > screens. If I click on the Exit button the second time, then it makes 
>> > my
>> > application terminates.
>> >
>> > What modification shall I do to extinguish the pushbuttons when I go
> back
>> > to
>> > my application?  Please help.
>> >
>> > Thanks,
>> > Carmelo
>> >
>> >
>> >
>> >
>> > //////////////////////////////////////////////////////////////////////
>> > 
>> >   DBGET2.PRG
>> >   Copyright:
>> >       Alaska Software, (c) 1997-2003. All rights reserved.
>> >   Contents:
>> >       Standard Get screen for a database combined with pushbuttons.
>> > 
>> >       This file must be linked in windows mode (/SUBSYSTEM:WINDOWS
>> >       or /PM:PM) since it uses graphical pushbutton objects.
>> > 
>> > //////////////////////////////////////////////////////////////////////
>> >
>> > #include "Getexit.ch"
>> > #include "AppEvent.ch"
>> > #include "SetCurs.ch"
>> >
>> > /*
>> > * Position and height for pushbuttons.
>> > */
>> > #define B_TOP     90
>> > #define B_HEIGHT  30
>> >
>> > ****************
>> > PROCEDURE Main()
>> >
>> >   LOCAL GetList:={}, lExit
>> >
>> >   SetMouse(.T.)
>> >   SetCursor( SC_NORMAL )
>> >   SetAppWindow():AutoFocus := .F.
>> >   SetAppWindow():AutoMark  := .F.
>> >
>> >   SET DEFAULT TO "..\..\DATA"
>> >   USE dgetcust EXCLUSIVE
>> >   SET DELETED ON
>> >   GO TOP
>> >
>> >   SET SCOREBOARD OFF
>> >
>> >   SetColor( "N/W, W+/B, B/W, R/W, W+/N" )
>> >   CLS
>> >
>> >   @  0, 0 TO 24,79 DOUBLE
>> >   /*
>> >    * Creation of the GET mask
>> >    */
>> >   @  0, 1 SAY PADC(" Change Customer ", 76, CHR(205))
>> >
>> >   @  1, 1 TO 8,78
>> >   @  2, 7 SAY "c/o:"         GET  MR_MRS
>> >   @  2,14 SAY "(1=Mr. 2=Mrs. 3=Miss 4=Sirs)"
>> >
>> >   @  3, 5 SAY "Name1:"       GET  NAME1
>> >   @  4, 5 SAY "Name2:"       GET  NAME2
>> >   @  5, 4 SAY "Street:"      GET  STREET
>> >   @  6, 7 SAY "Zip:"         GET  ZIP
>> >   @  7, 6 SAY "City:"        GET  CITY
>> >   @  2,53 SAY "CustNo:"      GET  CUSTNO
>> >   @  3,54 SAY "Phone:"       GET  PHONE
>> >   @  4,56 SAY "Fax:"         GET  FAX
>> >   @  6,49 SAY "BusinessID:"  GET  BUSINESSID
>> >   @  9, 1 TO 13,78
>> >   @ 10, 3 SAY "Remarks:"     GET  REMARK1
>> >   @ 11,12                    GET  REMARK2
>> >   @ 12,12                    GET  REMARK3
>> >
>> >   @ 14, 1 TO 16,78
>> >   @ 15, 5 SAY "First:"       GET  FIRSTDATE
>> >   @ 15,23 SAY "Last:"        GET  LASTDATE
>> >   @ 15,39 SAY "Responsible:" GET  KEYPERSON
>> >
>> >   /*
>> >    * Create pushbuttons (they are automatically added to the
>> >    * child list of the current SetAppWindow() object -> XbpCrt window)
>> >    */
>> >   PushButton ( { 25, B_TOP }, { 50, B_HEIGHT }, "Help",      ;
>> >                       {|| GetHelp() } )
>> >
>> >   PushButton ( { 120, B_TOP }, { 50, B_HEIGHT }, "Next",     ;
>> >                {|| GetUpdate(), DbSkip(1), GetRefresh(GetList) } )
>> >
>> >   PushButton ( { 220, B_TOP }, { 80, B_HEIGHT }, "Previous", ;
>> >                {|| GetUpdate(), DbSkip(-1), GetRefresh(GetList) } )
>> >
>> >   PushButton ( { 340, B_TOP }, { 50, B_HEIGHT }, "New",      ;
>> >                {|| GetUpdate(), DbAppend(), GetRefresh(GetList) } )
>> >
>> >   PushButton ( { 430, B_TOP }, { 70, B_HEIGHT }, "Delete",   ;
>> >                {|| GetUpdate(), DbDelete(), GetRefresh(GetList) } )
>> >
>> >   PushButton ( { 540, B_TOP }, { 50, B_HEIGHT }, "Exit",     ;
>> >                {|| PostAppEvent ( xbeP_Close ) } )
>> >   @ 20, 0 SAY "" + Replicate("", 78) + ""
>> >
>> >   ColorSelect(3)
>> >   @ 21, 9 SAY "Simple Get entry screen programmed in procedural style
>> > using"
>> >   @ 23, 9 SAY "@ SAY...GET and graphical Pushbuttons (Xbase++ hybrid
>> > mode)"
>> >   ColorSelect(0)
>> >
>> >   lExit := .F.
>> >
>> >   DO WHILE ! lExit
>> >      READ SAVE
>> >      IF LastAppEvent() == xbeK_PGDN
>> >         DBSKIP(1)
>> >      ELSEIF LastAppEvent() == xbeK_PGUP
>> >         DBSKIP(-1)
>> >      ELSEIF LastAppEvent() == xbeP_Close
>> >         /*
>> >          * The user has closed the window via system menu and
>> >          * READ SAVE was terminated. This terminates the program, too.
>> >          */
>> >         AppQuit()
>> >      ENDIF
>> >      GetRefresh(GetList)
>> >   ENDDO
>> >
>> > RETURN
>> >
>> > *******************
>> > PROCEDURE AppQuit()
>> >  CLOSE ALL
>> >  QUIT
>> > RETURN
>> >
>> > *******************
>> > PROCEDURE GetHelp()
>> >
>> >   LOCAL cScreen, nRow := Row(), nCol := Col()
>> >
>> >   AEval( SetAppWindow():ChildList(), {|o| o:hide() } )
>> >   SetAppFocus ( SetAppWindow() )
>> >
>> >   SET CURSOR OFF
>> >
>> >   cScreen := SaveScreen(0,0,MaxRow(),MaxCol())
>> >   CLS
>> >   ?
>> >   ? "This is assumed to be a Help-Screen"
>> >   ?
>> >   ? "The current field is:", READVAR()
>> >   ?
>> >   WAIT
>> >
>> >   RestScreen(0,0,MaxRow(),MaxCol(),cScreen)
>> >
>> >   AEVAL( SetAppWindow():ChildList(), {|o| o:show() } )
>> >
>> >   SetPos( nRow, nCol )
>> >
>> >   SET CURSOR ON
>> >
>> > RETURN
>> >
>> > *******************************
>> > PROCEDURE GetRefresh( GetList )
>> >   LOCAL i, imax := Len(GetList)
>> >   LOCAL oGet, nRow := Row(), nCol := Col()
>> >
>> >   SET CURSOR OFF
>> >
>> >   FOR i:=1 TO imax
>> >      oGet := GetList[i]
>> >      oGet:updateBuffer()
>> >   NEXT
>> >   SET CURSOR ON
>> >   SetPos( nRow, nCol )
>> >
>> > RETURN
>> >
>> > *******************************
>> > FUNCTION GetUpdate()
>> >
>> >  /*
>> >   * If the text buffer of the current GET object has changed, the
>> >   * buffer must be saved and the current GET object must loose its
>> >   * input focus.
>> >   */
>> >   IF GetActive():changed
>> >      RETURN GetKillActive()
>> >   ENDIF
>> >
>> > RETURN NIL
>> >
>> > /*
>> > * Create new XbpPushButton object in current XbpCRT window and
>> > * set default values.
>> > */
>> > FUNCTION PushButton ( aPos, aSize, xCaption, bBlock )
>> >
>> >   LOCAL button
>> >
>> >   button := XbpPushButton():New ( NIL, NIL, aPos, aSize )
>> >   /*
>> >    * Assign caption (String or resource ID of bitmap)
>> >    */
>> >   button:Caption  := xCaption
>> >   /*
>> >    * The button does not receive keyboard focus.
>> >    */
>> >   button:PointerFocus := .F.
>> >   /*
>> >    * The button is not visible immediately after :create()
>> >    */
>> >   button:Visible      := .F.
>> >   /*
>> >    * Assign activate code block.
>> >    */
>> >   button:Activate := bBlock
>> >   /*
>> >    * Create button (request system resources)
>> >    */
>> >   button:Create ()
>> >
>> >   /*
>> >    * Change Font.
>> >    */
>> >   button:SetFontCompoundName("10.Helv")
>> >   /*
>> >    * Display button with new font.
>> >    */
>> >   button:Show ()
>> >
>> > RETURN button
>> >
>> >
>> >
>> >
>>
>>
>
>