Whilst I can see your points, I do actually draw the box/line every time the data is refreshed.The times of DOS when the screen was under your control alone are long gone. Your program cannot control if the OS wants to repaint your windows. Suppose your program is running and all your user-drawn code has been executed correctly. But then you decide to switch to the browser and look for something. When you return to your program the OS will repaint your form. But the form's Paint method does not know about the additional code in DrawLine. The only way to make user-drawn code being executed whenever needed is to put it into the OnPaint event (or call it from there).
I also make [DrawLines] the last call so that they are on top of anything already on the canvas.
The times of DOS when the screen was under your control alone are long gone.I will pull myself out of the DOS environment !! promise :)
Your program cannot control if the OS wants to repaint your windows. Suppose your program is running and all your user-drawn code has been executed correctly. But then you decide to switch to the browser and look for something. When you return to your program the OS will repaint your form. But the form's Paint method does not know about the additional code in DrawLine.Oddly enough, I did do this test and it was negative - ie. I dragged other program windows over my form which had the box and line showing and they were still there when I moved the window away. In the light of SkyKhan's suggestion of minimize and restore, I found that that did destroy the box/line, as did dragging my window off the edge of the screen and back again.
The only way to make user-drawn code being executed whenever needed is to put it into the OnPaint event (or call it from there).(or call it from there) This is a 'Key' statement - - - I've created an OnPaint event which just calls the DrawLine procedure and Voila! box and line appear on every record :D :D
In order to draw the thick box your navigation code must store some information on which record will get the highlighting border and/or the coordinates of the box rectangle in some local form variables, and it must call Invalidate to retrigger a paint cycle of the form. The Form's OnPaint must draw the rectangle.I've played a little with the demo and can see some useful bits of code. As yet I haven't needed to add 'Invalidate' so can't fully understand the implications. I'll have to spend more time 'playing'.
Maybe the attached demo is of any help
Oddly enough, I did do this test and it was negative - ie. I dragged other program windows over my form which had the box and line showing and they were still there when I moved the window away. In the light of SkyKhan's suggestion of minimize and restore, I found that that did destroy the box/line, as did dragging my window off the edge of the screen and back again.It works like this since Vista, when built-in double-buffering was implemented. On XP and older systems - system calls WM_PAINT every time, when your window needs to be painted on a screen. That's because older computers had lesser memory and OS developers didn't want to take such responsibility, as implementing double-buffering by default - it was your responsibility. If you wouldn't properly respond to this event on old OS - you would see desktop inside your window's border. That's, what sometimes happens, when application hangs or works too slowly. I think, you should design your application with this behaviour in mind for backwards compatibility.
Maybe I miss the mark, but I would draw such lines in OnCreate and assign the bitmap to a TIMAGE... done... :PYou missed the mark it in sofar that you - probably unintentionally - implement a buffered pattern. That's not necessary, because that can also be done by the doublebuffered property.
@ handoko
I don't really have a problem with publicizeing my project (even though, as you've understood, the data is 'live' and personal) except that it is some 12000 lines long and calls on 26 databases of information!
:D :D :D@ handoko
I don't really have a problem with publicizeing my project (even though, as you've understood, the data is 'live' and personal) except that it is some 12000 lines long and calls on 26 databases of information!
Please, please don't do work like this on live, real data. Even if what you're doing isn't directly involved with the data, you know what's going to happen.
Been there ....
Interesting, tell me more. I rarely do database programming. :-[
... This is called EVERY time data is written to any file.
It will cause noticeable program slowdown, won't it?It will be measurable but hardly noticable, because both the hard-disk hardware and the OS perform caching. Unless you restructure a table or something...Or re-index.
Quote... This is called EVERY time data is written to any file.It will cause noticeable program slowdown, won't it?
@ RAW:D
Your suggestion is beyond my comprehension, so maybe I also 'miss your mark'. The VATPanel is only shown as and when required rather than an integral part of the main form.
What I got in mind was something like this:That may well be a fully OOP method using a secondary 'Form' but my VATPanel is just one of 10 Panels and it seems far more complex than my simple VATPanel.show or .hide method.