dcget combo

This forum is for eXpress++ general support.
Post Reply
Message
Author
Koverhage
Posts: 151
Joined: Mon Feb 01, 2010 8:45 am

dcget combo

#1 Post by Koverhage »

It is possible to make a combo with pushbuttons ?
I wish that the user does not scroll in text, rather he can click on a button.
Example:
Attachments
Unbenannt.png
Unbenannt.png (6.14 KiB) Viewed 7595 times
Klaus

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dcget combo

#2 Post by rdonnay »

Klaus -

I don't want to make any changes to DCGET..COMBO.

Here is some code that shows you how to do this.

Code: Select all

#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"

FUNCTION Main()

/* This example shows how to create a drop-down button list
   from a POPUP button on a GET */

LOCAL GetList[0], cText, bPopUp, oStatic, nPopKey

cText := Space(30)

bPopUp := {|c,oGet|DropButtons(c,oGet,oStatic)}

@ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX SIZE 80,15 ;
      OBJECT oStatic

DCSETPARENT oStatic

@ 1,1 DCSAY 'Enter some text' GET cText POPUP bPopUp SAYSIZE 0

nPopKey := DC_SetPopKey(xbeK_SH_DOWN)

DCREAD GUI FIT ADDBUTTONS TITLE 'Enter File Names' ;
   SETAPPWINDOW

DC_SetPopKey(nPopKey)

RETURN nil

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

PROC appsys ; RETURN

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

STATIC FUNCTION DropButtons( cText, oGet )

LOCAL GetList[0], aPos, GetOptions, oStatic

aPos := DC_CalcAbsolutePosition({0,0},oGet)

@ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX OBJECT oStatic ;
      SIZE 200,85

DCSETPARENT TO oStatic

@ 10,10 DCPUSHBUTTON CAPTION 'Button 1' SIZE 90,30 ;
        ACTION {||cText := 'Button 1', DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}

@ 45,10 DCPUSHBUTTON CAPTION 'Button 2' SIZE 90,30 ;
      ACTION {||cText := 'Button 2', DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}

@ 10,100 DCPUSHBUTTON CAPTION 'Button 3' SIZE 90,30 ;
      ACTION {||cText := 'Button 3', DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}

@ 45,100 DCPUSHBUTTON CAPTION 'Button 4' SIZE 90,30 ;
      ACTION {||cText := 'Button 4', DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}

DCGETOPTIONS ;
   NOTITLEBAR ;
   BORDER XBPDLG_NO_BORDER ;
   ALWAYSONTOP ;
   PIXEL

DCREAD GUI FIT TITLE 'Choose a button' OPTIONS GetOptions ;
   EVAL {|o|o:setPos({aPos[1],aPos[2]-o:currentSize()[2]+10})} ;
   MODAL ;
   HANDLER buttonHandler

RETURN cText

* ----------

STATIC FUNCTION buttonHandler( nEvent, mp1, mp2, oXbp, oDlg, GetList )

IF nEvent == xbeP_KillDisplayFocus
  RETURN DCGUI_EXIT_ABORT
ENDIF

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

Koverhage
Posts: 151
Joined: Mon Feb 01, 2010 8:45 am

Re: dcget combo

#3 Post by Koverhage »

Roger,

you should not change anything ito DCGET...COMBO.

Thanks for the code sample.
Klaus

Post Reply