MS Access image attachment flicker - image

I have a form (MS Access) which manages image attachments and a couple of reports which display those attachments based on various selection criteria. All of the image files (.jpg ) are kept to a maximum size of 1.4Mb. The form shows only one image at a time and as I move to each record, the new image flickers - usually displaying, clearing then displaying again. Occasionally the image displays just once but there seems to be no correlation between this behaviour and image size - the smaller attachments usually suffer the same effect and the larger attachments sometimes display once without flickering. There appears to be some phase issue between form display and image display but I am only guessing.
In the reports, there is no flicker on initial display and as long as I don't use the scroll bar up/down arrows or drag the slider, any refresh is acceptable (certainly not slick but I can live with that). Clicking on the scroll bar region either side of the slider, the refresh is acceptable (not slick). Using the slider or the arrows, things get unacceptably strobic.
I have searched online for "MS ACCESS", Attachment, Image, Flicker several times but all I can find are articles on flickering forms, which is not a problem in this application running on Windows 10 64-bit, plenty of memory, 2Gb graphics. I can't find anything relevant to image attachment flicker.
My main concern is to improve the usability of the form; for the reports, careful advice not to drag the slider or use the scroll bar arrows will be enough, at a pinch.
In the context of my current application, this isn't a huge problem since image attachments are not a critical requirement. All the same, I would like to know of any way to stop the flicker for anything in the future where it is more important.
Edit, following further investigation prompted by suggestions below.
I played around with putting .visible = false and .visible = true into various event handlers but with not much change, except to make the flickering worse with at least one combination. I'm not sure what code I could provide to help you suggest anything but the following might be of use:
The form's record source is a single table which provides one field "imagelink" of data type attachment, plus two text fields: "description" (short text) and "comments" (long text). In addition, the form has three combo boxes. Two of these have a row source of simple SQL on one parent table each, tblSite and tblSpecies, with the foreign key hidden in both cases, just tbleSite.sitename and tblSpecies.commonname visible in the combo boxes. The third combo box has a simple SQL row source on one table (tblColour) which is a child of tblSpecies, constrained by a WHERE clause to offer only those colour types applicable to the current species. Apart from a Delete button, that is it.
I put some MsgBox traces into several event handlers to see what was happening. I used MsgBox rather than the debugger as I wanted to see the events and the behaviour on screen at the same time (Access noob). This is what happened, with no .Visible = False/True code active:
On firing up the form from scratch:
No image visible
Form_Open
Form_Load
attImage_AttachmentCurrent
Form_Current
The image appears, no flicker
Detail_Paint (twice)
On subsequently going to the next record via the navigation buttons:
Detail_Paint
First image blanks
Detail_Paint
First image reappears
Detail_Paint
First image blanks
Detail_Paint
Next (second) image appears
Detail_Paint (three times)
Second image blanks
Detail_Paint
Second image reappears
attImage_AttachmentCurrent
Form_Current
Detail_Paint
Second image blanks
Detail_Paint
Second image reappears
Detail_Paint
Second image blanks
Detail_Paint
Second image reappears
The sequence above occurs every time I move from one record to another. There will no doubt be other events; I have traced only what I thought to be the most relevant.
Further, while staying on any one record but changing focus between the various text and combo boxes via mouse clicks, this happens:
Detail_Paint
Image blanks
Detail_Paint
Image reappears
There is also a Delete button on the form, which occasionally (I haven't yet tried to trace this) causes the image to flicker as the mouse passes over it - I suspect lots of Detail_Paint events. That doesn't always happen - I could do some more tracing if required but I feel I am missing some very simple, obvious point (Access noob, as already said).
The only other event code I have is:
After Update on site and species, to ensure that only one or the other is not null and to enable/disable the other combo boxes accordingly (an image can be of an insect or a site, not both, a colour can only be assigned to an already selected species). The After Update on species also resets the Colour combo box row source to restrict the colours to those relevant for the new species.
It feels to me that setting .visible = False on leaving a record, then .visible = True once the new record has settled down, might work. However, I can't see any suitable Detail event that could do this. On_Next_Record_Click and On_Current_Record_Finshed_Doing_Stuff would help but there are no such things as far as I can see.
If there is any of the existing code you think might be of use, I can attach details. I still have some hair left. I apologise for anything silly I have done but event processing was never my strength - give me procedures, please.

I had the same problem in my database where when I went from one record to another the photo attachment would flicker. I used the application.echo property and turned it off on the current event code, but was still having the problem.
I realized that it was running through an after update event as well, but when I turned the application.echo off on that code it eliminated the flicker.
Make sure to turn the application.echo back on at the end of each Subroutine.

To prevent the screen from flickering in moving on a form from one attachment to the next, you could combine the Attachment control’s KeyDown event with the Timer event for the form.
I achieved the desired result by turning screen repainting off on the Attachment control’s KeyDown event and by turning it on again when the Form's Timer occurs. The form's TimerInterval property specifies the interval between Timer events. In my case, one millisecond was sufficient to prevent flickering.
Private Sub Attachment_Artwork_KeyDown(KeyCode As Integer, Shift As Integer)
If 33 = KeyCode Or _
34 = KeyCode Or _
37 = KeyCode Or _
38 = KeyCode Or _
39 = KeyCode Or _
40 = KeyCode Then Application.Echo False
End Sub
Private Sub Form_Timer()
Application.Echo True
End Sub

Related

Oracle Reports-How To Add Field Object To Repeating Frame

I want to add field object to an existing repeating frame.But when I drag the field, new frame is generated.
See Image below.
I want to do is put the field F_PO_NUMBER under R_INVOICE frame.
Doble-click on the Paper Layout node.
Touch R_INVOICE repeating frame on the Object Navigator.
Change Fill colour of R_INVOICE by selecting a different than that already has ( colour palette pointers are located on the left side of the Paper Layout ).
Let's choose gray as fill colour, and then there will appear a great gray box on the Paper Layout.
Just drag F_PO_NUMBER to the inside of that gray box. If some frames or objects slides as you drag F_PO_NUMBER, apply immediately an undo by pressing Ctrl+Z, and play with Flex On/Off or Confine On/Off buttons up to your object is able to be removed into that gray box.
I'd suggest you to
create a backup copy of that RDF file - you might need to restore the report if something goes wrong
go to paper layout editor
turn flex OFF (so that frames wouldn't stretch)
select any field in the R_INVOICE frame (for example, F_INVOICE_NUMBER)
copy/paste it (Ctrl+C / Ctrl+V)
a new item (named F_INVOICE_NUMBER1) will be created slightly right & below from the original item)
move it to a new position
if necessary, switch flex ON (and, possibly, confine ON/OFF), but be very careful because you might spoil current layout, and - if you do that - it might be difficult to revert changes. Undo works only 1 level back
change its name & source so that they are appropriate (i.e. F_PO_NUMBER)
save & run the report. Hopefully, it'll be OK.
P.S. As you already have the R_1 frame (which is useless), I'd suggest you to remove (in paper layout editor) it, as well as current F_PO_NUMBER field (visible on your screenshot).

ZedGraph scrolling left truncates data

I am using a ZedGraphControl in a WindowsForms project in C#. The ZedGraphControl is V5.1.5.
The data in the control is static and I add it all before the form is shown. The X axis of the data consists of numbers indicating seconds offset from the beginning. in other words from 0 to some number of seconds.
I want to initially show the last 5 seconds, but provide a horizontal scrollbar so the user can scroll back and forth. I set the "graphPane.XAxis.Scale.Max = maxX;" where maxX is the largest X value in my data. I set the "graphPane.XAxis.Scale.Min = maxX - 5;".
The data starts off displaying the way I want it, but when the user scrolls the horizontal bar, bizzar behavior occurs.
As you drag the thumb of the scrollbar to the left, the beginning of the data shown in the grid moves to the lower values as expected, and the thumb of the scrollbar moves to the left, but the right edge of the thumb stays at the right of the scrollbar and you cannot move back to the right. It is as if the data to the right of the viewing range gets truncated as you scroll left.
I cannot find any reason for this nor any way to control it. Does anyone have any ideas about this behavior?
Ok, found it myself.
I found a fine article that describes scrolling:
Add a ScrollBar
In it the author specifically says "the scrolling will be wacky because the scrollable range has not been set".
I used the sample "Manually Setting the Scroll Range" and the part that I was missing is setting the zedGraphControl1.ScrollMinX and zedGraphControl1.ScrollMaxX properties. Once I defined these values everything started working as expected. I also found that in my case, the value of zedGraphControl1.IsAutoScrollRange had no effect, but I left it set to false to be consistent with the example. This would probably have an effect if the dataset is dynamic.

how to keep a running score in a textbox/object in powerpoint

My powerpoint is made is like a quiz, one slide has a question and 4 answers (buttons with text, not numbers) that can be clicked on. When an answer is clicked on, it is linked to another slide that explains if the answer being right/wrong and then adds/subtracts points from the score.
Currently what I have done is a simple macro that each button is linked to and upon clicking any of the 4 answer buttons, it will go to a certain slide and show a pop up box with their current score.
What I want to do is have either a text box or some object that holds the score throughout the entire presentation and ideally if possible, the score resets when the ppt is closed or opened but the running score is the most important aspect I'm trying to hammer down.
Is this possible for what I'm asking? Let me know if there are any details that would help
Instead of resetting the score when the presentation shuts down, do it at startup. For example, you could put a "Begin the quiz" button on the first slide, have it reset the score, then move to the next slide.
As to where to store the score, there are a number of ways of doing it. One would be to put a rectangle or text box on the last slide and store the score as its text. Make sure the rectangle's sent to back so it's the first shape on the slide, or change Shapes(1) below to indicate the actual z-order position of the shape.
Function SetScore(lScore as Long)
Dim lLastSlide as Long
lLastSlide = ActivePresentation.Slides.Count
With ActivePresentation.Slides(lLastSlide).Shapes(1).TextFrame.TextRange
.Text = Cstr(lScore)
End With
End Function
A companion GetScore function should be easy to come up with, similar to the above.

what happen at background when you click inside a textbox?

Inside a MFC dialog, I have 2 overlapping rows of text boxes (what user can see is only one row). when I clicked a button, i shifted down the row at bottom, so now user can see both rows.
The problem is if I have some data loaded in DoDataExchange() for the text boxes, I wouldn't be able to see them showing when the dialog boots up. But when I click inside the text box, the data shows.
I want to know what exactly happen when I clicked a UI? What drawing functions are invoked at backgrounds? So I can fix my problem.
Thank you.
ZQ
Nothing is drawn when you click, maybe you are seeing an Invalidate() being triggered for some reason that redraws the text boxes. Or maybe the parent control (dialog, I assume) doesn't have WS_CLIPCHILDREN set, or some other funny things are happening with the WS_CLIPXXX flags (they're somewhat of a black art).
More to the point, use Spy++ to check what 'happens' when you click - i.e. the messages that are posted at each point in time.

How to visually reject user input in a table?

In the programming of a table-based application module (i.e. the user mostly enters tabular data in an already laid-out table), how would you reject user input for a given cell?
The scenario is: the user edits the cell, enters something (text, picture, ...) and you want them to notice when they finish editing (hitting enter, for example) that their entry is not valid for your given "format" (in the wider meaning: it can be that they entered a string instead of a number, that their entry is too long, too short, they include a picture while it's not acceptable, ...).
I can see two different things happening:
You can rather easily fit their entry into your format, and you do so, but you want them to notice it so they can change if your guess is not good enough (example: they entered "15.47" in a field that needs to be an integer, so your program makes it "15")
You cannot guess what to do with their entry, and want to inform them that it's not valid.
My question specifically is: what visual display can you offer to inform the user that his input is invalid? Is it preferable to refuse to leave the editing mode, or not?
The two things I can imagine are:
using colors (red background if invalid, yellow background for my case 1 above)
when you reject an input, do something like Apple does for password entry of user accounts: you make the cell "shaking" (i.e. oscillating left and right) for one second, and keep the focus/editing in their so they don't loose what they've typed.
Let's hear your suggestions.
PS: This question is, at least in my thought process, somehow a continuation and a specialization of my previous question on getting users to read error messages.
PPS: Made this community wiki, was that the right thing to do on this kind of question or not?
Be careful using autocorrection such as forcing user input to fit your format. See:
Is it acceptable to normalize text box content when it loses focus?.
It’s generally better to prevent invalid entries in the first place than to autocorrect them later. For example, if only integers are allowed, then you ignore any keying of the decimal point (along with all letters and most special characters). In some environments, you may want to provide a quiet audible signal that input is ignored (e.g., a dull thud).
As for when you need to alert the user to an error, how about a callout? Draw a bright line from the control or point in question (field, status annunciator, button, menu, location of a drag and drop) to the margin of the window and put a brief message (two or three words, like "Unrecognized date") in a balloon. Placing the message on the margin should keep it from occluding anything of interest in a crowded table.
The sudden appearance of the call-out should be sufficient to catch user attention, so it's okay to let the user move on to other cells in case they want to fix the error later. For efficiency, you may want to hold the user in the error-related field when the error originally occurs (since often the user wants to correct it right away), but then allow the next tab or mouse click to navigate the user away.
On mouseover or when focus is on the control associated with the error, the line is highlighted (to distinguish it from other callout lines that may be present) and the balloon expands to a full error message, providing more details on how to fix the problem (up to two sentences). Allow the user to drag and drop the balloon to a new location in case this occludes something of interest.
Include a Help button in the expanded balloon for further details. You can also include a button to fix the error (e.g., Retry, Reconnect, or set to default value).
The balloon disappears automatically when the error is fixed. Undo reverts whatever caused the error (e.g., reverts the field to its original value), which should clear the error.
If the user scrolls away from the place associated with the error, the balloon shrinks to an icon that remains in view so that the user is less likely to forget about it. Maybe an exclamation point in a triangle is a good icon. Place the icon beside or in the scrollbar track to indicate its relative location in the table, so the user can quickly scroll to find it later. Mouseover expands the icon to its full message. Perhaps clicking the icon can scroll to the right place in the table and put focus in the relevant control.
Balloons could also shrink to icons if they start visually interfering with each other. You may even want to include a control in a balloon to allow the user to force it to assume an icon.
For consistency, use for all errors, not just those associated with fields in tables.
The last time I did such a form (on a web page) I put a red box around the offending input.
I thought it was really neat... until a user asked me "Why's there a red box around this cell?"
What'd be nice is also displaying why the input's incorrect: "This field accepts only numbers", say.
You could display an icon in the cell, or a tooltip. The tooltip could open automatically or when mouse pointer hovers over the icon. It could disappear automatically when user edits another cell or when some timeout expires.
You can go with arrow tooltips like Adobe Flex's error tooltips. It focuses the attention to the error and supplies a brief description.

Resources