LB Booster
General >> General Board >> Impressed
http://lbb.conforums.com/index.cgi?board=general&action=display&num=1403345603

Impressed
Post by Sean on Jun 21st, 2014, 10:13am

I have a spreadsheet program that I wrote called MultiSpred. I use my own 'database' which is parsing strings with special characters denoting placemarkers for values in the string array. If you have come across Pick/Multivalue systems, you will know what I tried to do here. Anyway, to truly test the speed of the program, I used a spreadsheet containing lottery results, 960 rows by 30 columns, crammed with data. Before, to load the spreadsheet took a while and you could see the rows and columns being painted.
Now, with LBB, I selected the file and 1 second later it was loaded. Even faster than a version I created using a dll I wrote in FreeBasic.
I am very impressed. I wanted to share my code so you see the before and after result, alas, no attachments allowed.
So I just wanted to give you a high five.

Text editor does not wraplines
Post by Sean on Jun 22nd, 2014, 1:35pm

Richard, I saw that my text editor in the program above does not wrap lines. I used _ES_MULTILINE as a style bit originally, I tried what you suggested in another post. Still does not work. Any suggestions?
Re: Text editor does not wraplines
Post by Richard Russell on Jun 22nd, 2014, 3:34pm

on Jun 22nd, 2014, 1:35pm, Sean wrote:
Richard, I saw that my text editor in the program above does not wrap lines. I used _ES_MULTILINE as a style bit originally, I tried what you suggested in another post. Still does not work. Any suggestions?

I don't know what you tried, but word-wrap is trivial in LBB:

Code:
texteditor #w.te, 10, 10, 280, 280
stylebits #w.te, 0, _ES_AUTOHSCROLL or _WS_HSCROLL, 0, 0
open "Wordwrap test" for window as #w
wait 

Richard.
Re: Impressed
Post by Sean on Jun 23rd, 2014, 10:45am

Here is where I tried _ES_AUTOHSCROLL or _WS_HSCROLL

Code:
 
    sub EditWindow
       if EditOpen then
          call QuitFullEdit "#fulledit"
          if EditOpen then exit sub
       end if
       EditOpen = TRUE
       EditSave = FALSE
       Title$ = "Full Edit"
       WindowWidth = 595
       WindowHeight = 668 'DisplayHeight-100
       UpperLeftX=int((DisplayWidth - WindowWidth) / 2)
       UpperLeftY=int((DisplayHeight-WindowHeight)/2)
    
       Menu #fulledit,"&File","&Save",EditSave,"&Exit",QuitEditFromMenu
       Menu #fulledit, "&Edit", "&Cut      Ctrl+X", Cut,_
        "C&opy    Ctrl+C", Copy, "&Paste   Ctrl+V", Paste,_
        "&Undo    Ctrl+Z", Undo,"C&lear",Clear,|,_
        "&Select All",SelectAll
        open Title$ for window as #fulledit
        print #fulledit, "trapclose QuitFullEdit"
        print #fulledit, "resizehandler EditResize"
 
        hT=CreateTextEdit(hwnd(#fulledit), 1, 1, WindowWidth-10, WindowHeight-10)
        call SetFocus hT
 
        call SetWindowText hT,cellval$
        hFont=CreateFont("courier new",16)
        ret = SendMessageLong(hT,_WM_SETFONT,hFont,1)
    end sub

   Function CreateTextEdit(hW, x, y, w, h)
        style = _WS_CHILDWINDOW OR _WS_BORDER _
        OR _WS_VISIBLE or _ES_MULTILINE
' ---------  tried putting _ES_AUTOHSCROLL or _WS_HSCROLL here, 
'             but did not work
        hInst=GetWindowLong(hW, _GWL_HINSTANCE)
    
        calldll #user32, "CreateWindowExA",_
            0 as long,"EDIT" as ptr,_
            "" as ptr, style as long,_
            x as long,y as long,w as long,h as long,_
            hW as long, 0 as long, hInst as ulong,_
            0 as long, CreateTextEdit as ulong
    end function
 

Re: Impressed
Post by Richard Russell on Jun 23rd, 2014, 7:23pm

on Jun 23rd, 2014, 10:45am, Sean wrote:
Here is where I tried _ES_AUTOHSCROLL or _WS_HSCROLL but did not work

Of course it didn't - you're using a totally different set of STYLEBITS (study the code I listed and you will see that those two bits are being turned off, not on)!

Why are you using an API call rather than the native LB code I listed? If you must use an API call - which I don't recommend - you are on your own and will need to consult MSDN.

Richard.


Re: Impressed
Post by Sean on Jun 24th, 2014, 12:30am

No, the above code works fine using normal LB.

However after some googling, I found this solution
style = _WS_CHILDWINDOW OR _WS_BORDER OR _WS_VISIBLE OR _ES_MULTILINE OR _ES_WANTRETURN OR _WS_VSCROLL

The _ES_WANTRETURN did the trick and the _WS_VSCROLL gives me vertical scrollbars

Re: Impressed
Post by Richard Russell on Jun 24th, 2014, 1:36pm

on Jun 24th, 2014, 12:30am, Sean wrote:
No, the above code works fine using normal LB.

To reiterate, LB's TEXTEDITOR is not a standard Windows GUI control, therefore it will not respond to STYLEBITS as you might expect. In particular, LB's texteditor cannot do wordwrap at all.

LBB's TEXTEDITOR is a standard Windows GUI control, therefore it will respond to STYLEBITS as documented in MSDN, including wordwrap if the style is carefully chosen.

The LBB code I listed works by clearing two of the STYLEBITS which are otherwise set by default when a TEXTEDITOR is created.

Richard.