obj_text_currency.ControlSource = "" && There is no control source obj_text_currency.cMasterType = "USD" obj_text_currency.cDisplayType = "CAN$" obj_text_currency.nConversion = *** this is a system variable, based on where you store your exchange obj_text_currency.source_value = this is where you would call ControlSourceThere are three main methods in the class:
obj_text_currency.SetDisplay() *-- only fires when a form action occurs (such as when I move to the next record, save, etc...) *-- basically, this will only occur (or for my projects) when a oForm.REFRESH() is issued LOCAL lnValue, lnConversion lnValue = 0.00 lnValue = (THIS.SourceValue) lnConvert = THIS.nConversion THIS.Value = THIS.cDisplayType + " " + ALLTRIM(STR(lnValue / lnConvert,2))
obj_text_currency.ConfirmDisplay() *-- only fires when an object action occurs (i.e. we are not in readonly, must be doing an add/edit) ** just some regular code to check that we have the "CAN$" still, in the first four ** places, and that the following numbers are formatted as 99999.99 (or whatever you want). ** Then, reset the value to the verfied format.
obj_text_currency.ReturnValue() ** Only fires when a form action save occurs LOCAL lnValue ** same boring code to pickup the numbers from this value and ** create a decimal value again. It also reverses the conversion ** of the current value IF lnValue != &THIS.SourceValue REPLACE &THIS.SourceValue WITH lnValue ENDIFNow, each of the following Events/Methods call the above .ConfirmDisplay() method (overkill, I know, but I like to be safe) IF and ONLY IF the READONLY is .T.: