dcget range

This forum is for eXpress++ general support.
Post Reply
Message
Author
Zdeno Bielik
Posts: 147
Joined: Thu Jan 28, 2010 9:24 am
Location: Nitra, Slovakia
Contact:

dcget range

#1 Post by Zdeno Bielik »

Hi Roger,

please, can you add in next build for DCGET parameter RANGE also support for CodeBlock?
Now it accepts only numeric value, but I need/want sometimes defines range "run-time" due to some next parameters from called function(-s).

e.g.

cBlock := '{ || MyFunction(...) }' // any number will be returned
bRange := &( cBlock )

@ 1,1 DCGET nTemp PICT '99999' RANGE 0, bRange

TIA & Regards
Zdeno


s pozdravom

zdeno bielik
ace system, spol. s r.o.
štiavnická 18
949 01 nitra
http://www.acesystem.sk
tel: 0904 – 328 888
... s nami dostávate vždy viac

User avatar
Tom
Posts: 1176
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: dcget range

#2 Post by Tom »

Hi, Zdeno.

If the DCGET should only accept a range of values, this is correct:

Code: Select all

nValue := 1000
aRange := {1000,5000}

@ 1,1 DCGET nValue VALID {||nValue >= aRange[1] .and. nValue <= aRange[2]}
But the more elegant way would be to use a spinbutton instead. This is the control made for value entries limited by a range:

Code: Select all

@ 1,1 DCSPINBUTTON nValue SIZE 10,1 LIMITS aRange[1],aRange[2]
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

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

Re: dcget range

#3 Post by rdonnay »

Zdeno -

The below sample shows how easy it is to extend many of the eXpress++ commands by simply using the preprocessor.

Roger
#xTranslate GETRANGE <x>,<y> => VALID {|oGet|GetRange(oGet, <x>,<y>)}

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0], GetOptions, dDate, nNum, cString

dDate := Date()
nNum := 0
cString := 'aaa'

@ 0,0 DCSAY 'Enter a Date' GET dDate GETRANGE Date()-7,Date()+7 POPUP {|d|DC_PopDate(d,,,,,,2)}

@ 2,0 DCSAY 'Enter a Number' GET nNum GETRANGE 250, 500 PICTURE '999'

@ 4,0 DCSAY 'Enter a String' GET cString GETRANGE 'bbb', 'hhh'

DCGETOPTIONS SAYWIDTH 100 SAYRIGHTBOTTOM

DCREAD GUI FIT ADDBUTTONS TITLE 'Range Test' OPTIONS GetOptions

RETURN nil

* ---------

PROC appsys ; return

* ---------

FUNCTION GetRange( oGet, x, y )

LOCAL xValue, lStatus := .t.

xValue := oGet:get:varGet()

IF xValue < x .OR. xValue > y
DCMSGBOX 'Valid Range is ' + DC_Xtoc(x) + ' to ' + DC_Xtoc(y)
lStatus := .f.
ENDIF

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

Zdeno Bielik
Posts: 147
Joined: Thu Jan 28, 2010 9:24 am
Location: Nitra, Slovakia
Contact:

Re: dcget range

#4 Post by Zdeno Bielik »

Tom, Roger,

many thanks for tips and workarounds - I go try it.

Regards
Zdeno


s pozdravom

zdeno bielik
ace system, spol. s r.o.
štiavnická 18
949 01 nitra
http://www.acesystem.sk
tel: 0904 – 328 888
... s nami dostávate vždy viac

Post Reply