bb.donnay-software.com

Donnay Software Web Forums
It is currently Mon Dec 18, 2017 11:15 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Oct 30, 2016 7:44 am 
Offline
User avatar

Joined: Tue Jul 28, 2015 5:15 am
Posts: 77
With Express, when using
DCREAD GUI ;
ADDBUTTONS

You get a Ok Button and a Cancel Button.

1) What are the ACTION of these Buttons?

2) How can I find out what is the ACTION of a button, where is it located?

Thank you,

Alexandre


Top
 Profile  
 
PostPosted: Sun Oct 30, 2016 8:01 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 3524
Location: Boise, Idaho USA
If you look at line 3425 of _DCGETBX.PRG, this is where those buttons are created.

They are added to the GetList.

The ACTION for the OK button is {||DC_ReadGuiExit(self)}
The ACTION for the CANCEL button is {||DC_ReadGuiAbort(self)}

This is functionally equivalent to:

{||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}

and

{||DC_ReadGuiEvent(DCGUI_EXIT_ABORT,GetList)}


If you wish to change the ACTION clause you can override it by adding your own buttons with the BUTTONS clause.

Another trick, is to search for the buttons and change the action clause.

DCREAD GUI EVAL {||ChangeOKButtonAction(GetList)}

* -----------

FUNCTION ChangeOKButtonAction(GetList)

oButton := DC_GetObject(GetList,'DCGUI_BUTTON_OK')
oButton:activate := {||MsgBox('You are OK to leave this window'),DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}

RETURN nil

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
PostPosted: Sun Oct 30, 2016 8:44 am 
Offline
User avatar

Joined: Tue Jul 28, 2015 5:15 am
Posts: 77
Thank you Roger.

For the readers of this Subject, there is a sample in xDemo
In Samples Set 2
In ArrayEdit number 49

Code:
ELSEIF nAction = 9 // Exit and Save

  IF DC_MsgBox(,,{'Exit and Save Changes?'},,,,.t.)
    DC_ReadGuiEvent(DCGUI_EXIT_OK,aGetList)
  ENDIF
  RETURN .t.

ELSEIF nAction = 10 // Exit and Abort

  IF DC_MsgBox(,,{'Exit and Abort Changes?'},,,,.t.)
    DC_ReadGuiEvent(DCGUI_EXIT_ABORT,aGetList)
  ENDIF
  RETURN .t.



This is helpful when you whant to terminate the DCREAD GUI by another BUTTON.

Than you would have something like this in BUTTON before the DCREAD GUI

Code:
   @ 27,135 DCPUSHBUTTON CAPTION 'PGDN' SIZE 9,1.2 ;
         ID 'PAGE_DN' ;
         ACTION {|| sSCRGUI_PGDN(GetList) }


and the function would look like this

Code:
FUNCTION sSCRGUI_PGDN(aGetlist)

   DC_ReadGuiEvent(DCGUI_EXIT_OK,aGetList)  // this terminates the DCREAD
   zEPGDN() // this is just another function that I execute...

RETURN .T.


Choo-Choo


Top
 Profile  
 
PostPosted: Sun Oct 30, 2016 12:05 pm 
Offline

Joined: Thu Jan 28, 2010 9:11 pm
Posts: 605
Location: Steven Point, Wisconsin USA
I use the add buttons when I simply what an OK or cancel. However, if you want to validate something upon clicking OK, I usually add my own buttons in order to give the desired level of control I need prior to the dialog exiting and clearing. If I control the action, I am still in the dialog and can act according.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group