Sign in to follow this  
Followers 0
Mat

base converter dlg - updated 15/6/09

6 posts in this topic

#1 ·  Posted (edited)

Another program addon i've done, this one is as professional as possible, with context help (thanks to yashied), and calculating as you type etc.

Thanks to WBD for his improved _ToBase + _FromBase functions.

My main problems was the calculating as you type, as it led to a very slow program at times, but after I figured out a good method to do the roman numerals, I was pretty much sorted! The other one was using contexthelp with a window set on top, and I still haven't worked that one out...

Thanks also to yashied, for the nice nd easy context help udf's.

Download link

Downloads so far is shown on the download page

Mat

Edit: Updated download link.

Edited by Mat

Share this post


Link to post
Share on other sites



Your _IntToAny() function looks very complex! Granted that this doesn't have the error checking but it's a bit simpler:

Func _ToBase($iNumber, $iBase, $iPad = 1)
    Local $sRet = "", $iDigit
    Do
        $iDigit = Mod($iNumber, $iBase)
        $sRet = Chr(48 + $iDigit + 7 * ($iDigit > 9)) & $sRet
        $iNumber = Int($iNumber / $iBase)
    Until ($iNumber = 0) And (StringLen($sRet) >= $iPad)
    Return $sRet
EndFunc   ;==>_ToBase

WBD

Share this post


Link to post
Share on other sites

thats jennicos... Funny you should say it, i just noticed _ToBase in your sig!!

error checking is not a problem, I do that in the loop.

I'll have a proper look when I get back, i need to rush off now

MDiesel

Share this post


Link to post
Share on other sites

A companion function for _ToBase() is:

Func _FromBase($sNumber, $iBase)
    Local $iRet = 0, $sChar
    Do
        $iRet *= $iBase
        $sChar = StringLeft($sNumber, 1)
        $iRet += Asc($sChar) + 7 * (Asc($sChar) < 58) - 55
        $sNumber = StringMid($sNumber, 2)
    Until $sNumber = ""
    Return $iRet
EndFunc

HTH

WBD

Share this post


Link to post
Share on other sites

you clock in 0.2 ms faster from the tests i've done wbd, so i'm using yours!! Thanks to WBD, code now updated.

For some odd reason something wierd happens beyond 15 digits, I am building in testing the length at the mo.

MDiesel

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Updated with improvements to code, it also has resizing now.

MDiesel

and another!! I have almost "completed" it. (quote marks used deliberately, I very much doubt This will ever be truly complete.)

Edited by mdiesel

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0