Announcement

Collapse
No announcement yet.

Custom controls and arrays..

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jules Marchildon
    replied
    Borje;

    Your test fixture is lookin' Good!!!!

    Regards,
    Jules


    [This message has been edited by Jules Marchildon (edited January 11, 2001).]

    Leave a comment:


  • Borje Hagsten
    replied
    Thanks Jules. I once downloaded the free CodeMax editor code and
    have looked at it. Maybe that is the one you have too. While it's
    fairly easy to follow, it doesn't work the way I would like to use,
    but maybe I will have to give in and use the same approach myself.

    Tom, I have tried using byte pointers and it actually was a bit
    slower in many situations. I may have started in the wrong end
    with this project, since I've built it around simple array with
    dynamic strings. Seems like I need to build a memory management
    "engine" for home-rolled array of dynamic strings here. Could be fun.

    As it is, it works fine in one instance, but not in MDI projects,
    etc, which is a must for an editor control. I'll solve it. It's a
    too good project to be left behind in some drawer, so even if my
    time is limited, I'll find a way some day. The goal is to be able
    to kiss Rich Edit goodbye for good..

    Paul, thanks for the tip. I'll have a look at it.


    The code is not presentable in any way right now, but I have uploaded
    a small test program to http://www.tolken99.com/ed32edit.exe ,
    in case you want to see what will come.

    The sample shows an editor control in the makes, you could say. As
    it is, it has syntax coloring and right now, automatic UCASE for
    PB code. Light yellow background is just a test of %WM_CTLCOLOREDIT.
    It's quite fast, even before optimization.

    F2 sets bookmarks in marging. Ctrl+F3 and Ctrl+Shift+F3 moves between
    bookmarks. Will use other bookmarks in finished editor. Click in
    margin selects full line. Doubleclick in marging selects full SUB
    or FUNCTION, if line is within one of those.

    Since it's a raw copy, you only have three buttons to play around
    with, "Open..", for opening files, "UCASE" and "MCASE" test code
    for selected text, plus a right click menu with some neat test
    stuff in, like show/hide non-printable characters, turn syntax
    coloring on/off, add line numbers, etc.

    Oh yes, I have started working on a HTML syntax color parser too,
    so you can test to open up a HTML file with it, just to see.

    Left to do is solving the issue above, multilevel Undo/Redo, Syntax
    color parser for C++ code, or at least one that handles resource files
    properly, plus clearing out tons of test code and add some other
    things I personally like to see in an editor. Will take some time,
    but I promise I will share the resulting code, once it's ready..


    ------------------

    Leave a comment:


  • Paul Noble
    replied
    FWIW, there was a very good article 'Play VB's Strings' by Francesco Balena in the April 1998 edition of VBPJ. Some of it is of course VB-specific, but there's good stuff in there for us too, as it is fundamentally about dynamic strings and how to get performance out of them.

    The article appears to have been archived onto Francesco's own web site at http://www.vb2themax.com/ArticleBank...ID=ArticleBank (scroll down).

    Regards -

    Paul



    [This message has been edited by Paul Noble (edited January 10, 2001).]

    Leave a comment:


  • Tom Hanlin
    replied
    The line length limit for PowerBASIC is related to internal compiler buffers, not the IDE per se, which does use dynamic strings.

    Dynamic strings can be very slow in Windows. There are a few tricks that can make a dramatic speed difference to your programs. It's worth going out of your way to replace techniques that involve multiple string concatenation or trimming with other methods. Using a BYTE PTR to access string data can also make a drastic difference.

    Optimization of string handling is a moderately involved topic. I'll see if I can write something up when I get the chance.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Jules Marchildon
    replied


    [This message has been edited by Jules Marchildon (edited January 11, 2001).]

    Leave a comment:


  • Borje Hagsten
    started a topic Custom controls and arrays..

    Custom controls and arrays..

    I have a bit of a problem here. For a custom Edit control, I would
    like to use an array of dynamic strings, instead of a memory block
    with fixed length lines of strings.

    The last one is fairly easy - allocate memory, store handle, unlock,
    resize, lock, etc. I guess the current PB editor is built that way,
    hence the limit of 256 character per line.

    But for array of dynamic strings? Resizing a memory block for each
    and every change, then extracting the strings to be shown slows down
    everything too much. Even allocating some extra memory to avoid too
    much resizing doesn't help, since it's extracting the lines of text
    to be shown that makes it a bit too slow for my taste.

    So, my question is: Is there a fairly easy way of making an array
    of dynamic strings "Global" for one unique instance only ? Is this
    where "Threads" comes into the picture? Never had to deal with that
    area before, so I know very little about it, but before I start
    reading up on it, I thought I'd ask, in case someone knows of a
    better and/or easier way of doing it..


    ------------------
Working...
X