program

new topic     » topic index » view thread      » older message » newer message

Can anyone please find my error in this program?

--to calculate how many characters an EditText field may contain before
--scrolling

without warning

include win32lib.ew

constant
TextWin=create(Window,"Calculate Field Limit",0,0,0,400,100,0),
DataWin=create(EditText,"",TextWin,0,32,100,28,0)

integer w,maxX,character,ok
sequence s

procedure PaintWin(integer x1,integer y1,integer x2,integer y2)
    -- get font size
    s = getTextExtent( DataWin, "M" )
    w = s[1]

    -- get field size
    s = getSize( DataWin )
    maxX = s[3] - s[1]

    character=floor(maxX/w)

    setPosition(TextWin,0,0)

    wPuts(TextWin,"This field can hold an average of " &
                    sprintf("%d",character) & " characters before
scrolling")
end procedure
onPaint[TextWin]=routine_id("PaintWin")

procedure onOpenWin()
    setFont(TextWin,"Ariel",10,Bold)
    setFont(DataWin,"Courier New",10,Bold)
end procedure
onOpen[TextWin]=routine_id("onOpenWin")

WinMain(TextWin,Normal)


thanks all,

Judith

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu