If you draw the string on the fore layer you will be able to erase it with FErase.
Other options are to draw a rectangle in the background color, or to draw the text again using the background color.
Meanwhile, let me propose a problem. In the attached program I want to change the Mean and SD from 100 and 16 to 0 and 1 respectively. I want to show the change on the x-axis as soon as the new value is filled in in the textbox (let's say the 0 in the Mean textbox without ENTER). Now I have to switch textboxes and back to show the change.
Any ideas?
Entering the values does not raise any event..that is the problem...The only way I would see this working would be enableing a timer when a textbox got focus and the on timer.tick do a lost focus to the textbox, raising this way the lostfocus event...
Why don't you capture each key press, check for enter and call the lost_focus sub. That way you get an update on leaving the control or on pressing enter.
Sub tbMean_KeyPress (key)
if Asc(Key) = 13 then
tbMean_LostFocus
end if
End Sub
If you want to know what the text box is going to contain after the key press, key isn't added to the textbox until after the event is fired
Sub tbMean_KeyPress (key)
NewText = tbMean.text & key
' do something if necessary
End Sub
By the way. I don't know if you have noticed but your (I think this what it is called as I haven't got the program in front of me) Clear_Area routine is clearing parts of the curve as well.
Hi Agraham,
Thnx for your input. i will try that as well...
I know the Erase part of the graph is ersing some points but I dont know how to avoid that. I am calling the Erase function one pixel below the graph so it shouldnt erase parts of the graph. Havent found out how to erase just below the graph otherwise....
Marc
Hi there. You know, a while ago on this very forum, Erel added a library called barcode.dll that supports the textbox changed event that will raise each time a text box changes. I cannot remember the URL, but maybe if you write barcode in the search box of the forum you may find it and play around with it and see if that makes things a bit less daunting? Just a thought. Take care then.
I know the Erase part of the graph is ersing some points but I dont know how to avoid that. I am calling the Erase function one pixel below the graph so it shouldnt erase parts of the graph. Havent found out how to erase just below the graph otherwise
It is because you are doing graphics work using floating point numbers and the rounding to pixel Y values and X co-ordinates is working against you. You are also generating far more data than can be displayed, something like 800 data points rather than 215.
Ideally you need an array, 0 to 214, in your case, holding integer values. I believe that if you declare an array "as int16" you get an array of 16 bit integers (non-array variables are always 64 bit floating point) or you can obtain them by the int(somevariable) function. You can then draw your graphics with both integer X (array index) and Y (array value) and predict exactly what it will look like when you do co-ordinate arithmetic. If you need a more precise value for other puposes you can either have a "shadow" array holding those more precise values or calculate them using a corrected X index like (X-grwidth/2)/(215/8) as the input value to your formula.
Agraham, thanx, I have already tried out the exact resolution for my pixels and used the INT function in the earlier stages of development. The reason I sticked with this original is that there used to be a function to invert all the data back to probability. Since it is not included I can go easily back to my original and your suggestion. Thanks for that!
Marc