1. list box

I have created a simple list box to just display a text file. It seems that
as items are added to the box they are lost or overlayed. Do I have to size
the number of items in the box? If so how do I do that. I'm also sending the
404 message for the horizontal extension to get the hscroll bar to appear.
Does anyone know what the var name is for this 404 i found in the archives.
I don't want just the number in the program

here's the snipit of the code

constant mainWindow = create(Window,"Printout Viewer - "& rptName,
      0,sx,sy,sw,sh,0),
  idList = create(List,"",mainWindow,0,0,sw-7,sh-82,{WS_SCROLLBARS}),
        sb = createEx(StatusBar, "", mainWindow, 0, 0, 0, 0, 0, 0)
  setFont(idList, "Courier New",fs, Normal)

atom jk jk=sendMessage(idList,404,dw,0) -- set hscroll bar and display width

Also, how do you do a scroll bar command....i.e.
SB_PAGEUP....SB_PAGEDOWN....

thanks..

george

new topic     » topic index » view message » categorize

2. Re: list box

5/03/2002 11:23:21 AM, gwalters at sc.rr.com wrote:

>
>I have created a simple list box to just display a text file. It seems that
>as items are added to the box they are lost or overlayed. Do I have to size
>the number of items in the box? If so how do I do that. I'm also sending the
>404 message for the horizontal extension to get the hscroll bar to appear.
>Does anyone know what the var name is for this 404 i found in the archives.
>I don't want just the number in the program
>
>here's the snipit of the code
>
>constant mainWindow = create(Window,"Printout Viewer - "& rptName,
>      0,sx,sy,sw,sh,0),
>  idList = create(List,"",mainWindow,0,0,sw-7,sh-82,{WS_SCROLLBARS}),
>        sb = createEx(StatusBar, "", mainWindow, 0, 0, 0, 0, 0, 0)
>  setFont(idList, "Courier New",fs, Normal)
>
>atom jk jk=sendMessage(idList,404,dw,0) -- set hscroll bar and display width
>
>Also, how do you do a scroll bar command....i.e.
>SB_PAGEUP....SB_PAGEDOWN....
>
Here is some source code for a file viewer similar to the one you are creating.
Hope it helps.
-----------------

without warning
include win32lib.ew

constant LB_SETHORIZONTALEXTENT = 404
object VOID
integer vWindow,
        vFilePath,
        vList,
        vGetFile,
        vLbl1,
        vLbl2,
        vTabSize,
        vStatusBar
------------------------------------------
function DeTab(sequence pText)
------------------------------------------
    sequence lText
    integer lSPosn
    integer lTPosn
    integer lChar
    integer lTabSize

    lText = repeat(' ', vTabSize * length(pText))
    lTPosn = 0
    lSPosn = 1

    lTabSize = getNumber(vTabSize)
    if lTabSize < 1 then
        lTabSize = 4
    end if
    while lSPosn <= length(pText) do
        lChar = pText[lSPosn]
        if lChar = '\t' then
            lTPosn += (lTabSize - remainder(lTPosn, lTabSize))
        elsif find(lChar, {10,13,12,8,7}) then
            lTPosn += 1
            lText[lTPosn] = ' '
        elsif lChar >= ' ' and lChar <= '~' then
            lTPosn += 1
            lText[lTPosn] = lChar
        else
            lTPosn += 1
            lText[lTPosn] = '.'
        end if

        lSPosn += 1
    end while

    return lText[1..lTPosn]
end function
------------------------------------------
procedure click_vGetFile(integer self, integer event, sequence params)
------------------------------------------
    object lText
    integer lFH
    sequence lTextSize
    integer lMaxLineSize


    setText(vStatusBar, "Loading file, please wait...")
    doEvents(0)
    eraseItems(vList)

    lFH = open(getText(vFilePath), "r")
    if lFH < 0 then
        setText(vStatusBar, "File cannot be opened")
        return
    end if

    lMaxLineSize = 0
    lText = gets(lFH)
    while sequence(lText) do
        addItem(vList, DeTab(lText))
        if lMaxLineSize < length(lText) then
            lMaxLineSize = length(lText)
        end if
        lText = gets(lFH)
    end while

    lTextSize = getTextExtent(vList, "_")
    lMaxLineSize *= lTextSize[1]
    VOID = sendMessage(vList, LB_SETHORIZONTALEXTENT, lMaxLineSize, 0)

    close(lFH)
    setText(vStatusBar, "")

end procedure
------------------------------------------
procedure BuildWindow()
------------------------------------------
    vWindow     = createEx(Window, "File Listing", 0, 0, 0, 500, 550, 0, 0)
    vLbl1       = createEx(LText, "File Path", vWindow, 10, 5, 88, 20, 0, 0)
    vFilePath   = createEx(EditText, "C:\\EUPHORIA\\INCLUDE\\GET.E",
                              vWindow, 10, 25, 400, 25, 0, 0)
    vLbl2       = createEx(LText, "Tab Width", vWindow, 415, 5, 88, 20, 0, 0)
vTabSize    = createEx(EditText, "4", vWindow, 415, 25, 32, 25, ES_NUMBER,
    0)
    vList       = createEx(List, "", vWindow, 10, 60, 400, 400, WS_HSCROLL, 0)
vGetFile    = createEx(DefPushButton, "&List File", vWindow, 420, 60, 70,
    40,0,0)
    vStatusBar  = createEx(StatusBar, "", vWindow, 0, 0, 0, 0, 0, 0)

    setFont(vList, "Courier New", 10, Normal)

    setHandler(vGetFile, w32HClick, routine_id("click_vGetFile"))

end procedure

BuildWindow()
WinMain(vWindow, Normal)


---------
Cheers,
Derek Parnell 
ICQ# 7647806

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

Search



Quick Links

User menu

Not signed in.

Misc Menu