I have started a more complex program, and i would like some guidance.
I have a array of word, and i need to display its contents in a chart.
I had been dooing some testing and here is what i came up to:
on myform i create a scrollbar named sb
on myform i create a Timage named img
on img i create and load a bitmap named bm
and i browse the array up and down with the following code:
The output looks like file in attach.
All this works but i have some problem:
1. After i minimize the form them i restore it back the bitmap is cleared.
2. somehow i need to able to make a selection on that chart from point A to point B, and to have a vertical cursor so i can move it around the chart.
3. I need to draw vertical and horizontal grids on that chart.
This is my first interactive GUI programing , so i need for someone to tell me the method in how this GUI's are programmed. Thanks!!!
A couple of thoughts
Well done with this. I've usually stuck with charting components to do the hard yards; they're a lot easier, and there are some good free ones available. I'm impressed that you're doing this yourself.
I think you'll need to redraw the image every time it's invalidated. Minimising and restoring will require that, and also (completed or partial) hiding and showing. You could create your bitmap and save it to a temporary file, then load it into a TImage for display; that way you don't need to redraw it. Or you could just call your existing code from the OnPaint event. At least this is what I expect is going on here: try it and see.
Draw your grid lines (MoveTo, LineTo) before drawing your data. The data lines will be drawn over the grid lines.
The selection is more complex, and I'm not sure what kind of selection you want ... but you can set the cursor for the displaying TImage to the one you want (although I'm not sure what a vertical cursor is).
Thanks for reply, well technically what i want to do is not a chart, its more like a file editor, but more advanced.
Let me be more explicit about what i want here:
i have an array of word.
I display it as shown above.
Maybe to you the lines on the screen doesn't tell you much, but for me (as i was trained to work with similar file editing software) tells me a lot.
When i see the part im interested in, i want to select it, so the selection should give me the begin-end address of the data from array.
The so called "vertical cursor", i want a line from top to bottom to act as a cursor, to be able to move it around the screen, where its position will be the position from array.
And about the grid lines you give me in idea:
Instead of clearing bp , i will clear it and draw the grid at the same time, then will draw my data on it. Hows that sounds?
take a look in the component called "heartmachine", it will fit all your needs
and comes with full sources... so you can "learn" how to do some advanced features that will be very usefull to you.
you can modify it , learn the code, implement your code or modify and publish the original component with the modifications
Hi, thanks that helps a lot.
I have created a component, where i draw my background, my grid lines..... Everything is ok.(i have a bitmap, where i draw my things and on paint event i draw it to canvas)
I am displaying data from an array of byte.
I still need:
1. to create a line from top to bottom of my bitmap, and to be able to drag (left - right) by mouse, where the location on the bitmap is the address from my array.
2. If i click on my "line" and drag it , i need to make a selection with it.
If anyone has any idea how should i implement it, please share. Thanks!!!
|All times are GMT. The time now is 08:50 AM.|
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2015, vBulletin Solutions, Inc.