QERadiant Measurement Calculator


(TurdS) #1

May 30, 2007

  • QMC 2.5 Finished. No Backspace/Delete error. You can now use decimals! And has the Metric options!
    ====

Not to sure if this has been done before (if it has feel free to delete and flame me.)

I haven’t mapped in years but have had some pushing to start again; and I’ve always had issues getting the correct measurements in QER and have known others who have as well. So to help with that I wrote this program to give new mappers a little hand.

Keep in mind that I am a little better at mapping than Coding.

Download: QMC 2.5
Mirror (Thanks [DS]-=Pencil=-):QMC 2.5

If it helps cool. If you think it sucks, well, I guess go ahead and tell me.

TurdS


(Flippy) #2

Nice tool, but it would be even better if you implemented metric measurements (meters, centimeters etc) aswell :slight_smile:

What language did you use to write this?
I might be able to help you with the bugs… It’s a simple case of checking what key the user pressed on the KeyPress event of the textboxes. Check if it’s numeric, if it is then go ahead and continue, if it’s not either display a message, or better yet, simply ignore the keypress.


(TurdS) #3

Visual Basic 5. The only VB I have lying around =P Kinda old.

You know I didn’t even think about the metric part. I will add that in.

See I was using the KeyPress event at first but it would give the error msg then leave the bad value there, even after I gave it the code to clear it. Which left the user to use Backspace or Delete, and then get the error msg.

So I moved to the KeyDown Event and it got rid of the ghost character but now left me with the no BS or Del. I have it right now just checking to see if the characters inputed are between the 0-9 keycodes. I tried to have it check for the BS and Del keys but no matter what I tried it kept seeing it as falling outside the 0-9 keycodes.

And sadly I never took any classes or special teachings to learn VB. Just kinda sat around and fiddled with it a few years ago. Any pointers you have I am really open to trying them out. Also if you’d like to see the code itself PM me either here or on MSN/AIM.

TurdS


(nUllSkillZ) #4

You could check the ASCII codes.
So you would be able to let pass whatever key you want to pass.


(TurdS) #5

[EDIT]
Check OP for new info.
TurdS


(Flippy) #6

Did you do it like this?


Private Sub Text1_KeyPress(KeyAscii as Integer)

If Not IsNumeric(Chr$(KeyAscii)) = True Then
   'input is not numeric, stop the keypress
   KeyAscii = 0
End if
End Sub

This basically checks if the key the user pressed is numeric (a number). If it’s not, KeyAscii gets set to 0 and no character appears. You could even have it beep by using the “Beep” command.
You’d also have to check if the user is pressing delete backspace or maybe . or “,” , but i cant remember the keyascii values for them ^^

Also, this works in VB6, I don’t know if it’s the same in VB5… but i think it is :slight_smile:


(TurdS) #7

I did this:

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Then
  Exit Sub
End If
If KeyAscii = 127 Then
  Exit Sub
End If
If Chr(KeyAscii) < "0" Or Chr(KeyAscii) > "9" Then
  KeyAscii = 0
End If
End Sub

8 is Backspace and 127 is Delete. I forgot all about the Chr statement thing :stuck_out_tongue:

Thanks again!! :smiley:

[EDIT]
I make a lot of edits =P
Got the Metric options in. And added decimals. New download link up.


([DS]-=Pencil=-) #8

Prison Downloadmirror