1. CAN ANYONE HELP ME PLEASE, IS A EUPHORIA ROBLEM

Hello can anyone please help me i´m want to make a mathematical operation but i
don´t know how to doit i been trying for 3 day now and i still can´t do it i want
to get the % of something, and once i have it i want to send it to a file, this
is my code, please help e-mail me please hrangel at demet.com.mx
tahks for you help

include Win32lib.ew
without warning

--------------------------------------------------------------------------------
--  Window Window1
global constant Window1 = create( Window, "The Window", 0, Default, Default,
280, 80+ 19, 0 )
global constant OK = create( PushButton, "OK", Window1, 180, 20, 56, 28, 0 )
global constant cantidad = create( EditText, "", Window1, 28, 24, 116, 20, 0 )
--------------------------------------------------------------------------------
integer cienp
object tom
integer cinep2
procedure OK_onClick ()
cienp = open("\\ga.txt", "u")
tom = getText(cantidad)
cinep2 = (tom/10000)*100
puts(cienp, cinep2)
flush(cienp)
abort(1) 
end procedure
onClick[OK] = routine_id("OK_onClick")



WinMain( Window1, Normal )


new topic     » topic index » view message » categorize

2. Re: CAN ANYONE HELP ME PLEASE, IS A EUPHORIA ROBLEM

hebert rangel wrote:
> 
> Hello can anyone please help me i´m want to make a mathematical operation but
> i don´t
> know how to doit i been trying for 3 day now and i still can´t do it i want to
> get the
> % of something, and once i have it i want to send it to a file, this is my
> code, please
> help e-mail me please hrangel at demet.com.mx

Here is some code that might help you.

include Win32lib.ew
without warning
with trace
--------------------------------------------------------------------------------
--  Window Window1
global constant Window1 = create( Window, "The Window", 0, Default, Default,
280, 80+ 19, 0 )
-- Use Default Button to make a single ENTER key press all that's needed.
global constant OK = create( DefPushButton, "OK", Window1, 180, 20, 56, 28, 0 )

global constant cantidad = create( EditText, "", Window1, 28, 24, 116, 20, 0 )
--------------------------------------------------------------------------------
integer cienp
atom tom
atom cinep2

procedure OK_onClick (integer self, integer event, sequence parms)
 -- Open the file for text output.
 cienp = open("\\ga.txt", "wb")
 -- Get the value as a number
 tom = getNumber(cantidad)
 -- Divide it by 100 thus converting it to a %
 cinep2 = tom/100
 -- Format the result a a string and write to a file.
 printf(cienp, "%f%%", cinep2)
 -- Force the output to disk
 flush(cienp)
 -- Close down the application
 closeApp()
end procedure
setHandler(OK, w32HClick,  routine_id("OK_onClick"))

procedure cantidad_onKeyPress (integer self, integer event, sequence parms)
-- Only allow digits and one dot.
    integer pos
    -- See if the keystroke is an allowable character
    pos = find(parms[1], "0123456789.")
    -- if not the tell Windows to ignore it.
    if pos = 0 then
        returnValue(-1)
    end if
    -- if it is a dot, make sure that the field doesn't already
    -- contain a dot.
    if pos = 11 then
        if find(parms[1], getText(self)) != 0 then
            -- if it does, then tell Windows to ignore a subsequent one.
            returnValue(-1)
        end if
    end if
end procedure
setHandler(cantidad, w32HKeyPress,  routine_id("cantidad_onKeyPress"))

-- Start the app with focus on the input field.
WinMain( {Window1, cantidad}, Normal )



-- 
Derek Parnell
Melbourne, Australia
irc://irc.sorcery.net:9000/euphoria

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu