SI Units Information

SI is acronym for International System of units. The letter order of SI is because in French the name of the system is Système International d'unités. Units are second, metre (meter), kilogram, etcetera. There are also derived units like Hertz, Watt and Newton, and more.

Each assembly data block (ASMDATA/END ASMDATA) contains UTF-16 strings (WSTRING in PowerBASIC) of quantity name, unit name, symbol, pointer offsets and character count for each string. Details below.

There is nothing here that can't be quickly found with an Internet search. However, I noticed that on the web pages <sup> and </sup> tags were used for "squared" and "cubed" instead of the Unicode characters superscript 2 and superscript 3. When coping and pasting the result was a "normal" 2 or 3, not squared or cubed.

Jump to source code -
Include file of SI Unit ASMDATA blocks.
PBWin demo to lookup unit information from any one of the tree items.


Format Of ASMDATA In Include File
The label.
Used in CODEPTR() to get address pointer to the block. It is the quantity name with spaces and punctuation removed. First letter of each word in upper case for readablity by us, the compiler does not care. "L", for label, is appended to make sure no keywords are duplicated.
Some of the labels are pretty long, but this has no effect on compiled code size.
Pointer offsets to unit name and symbol strings.
I started with three DWORD (DD) offsets. One for each character count, string line. Then I noticed that the first one was always 12 for the first address after the three DWORDs. Deleted the first one, and assumed an offset of 8 to quantity name character count.
String lines for quantity name, unit name and symbol.
First on a line is a word (DW) having the character count of string. A word holds a value up to 65535. In this situation we won't come close to that. And, it saves using a DD line because WSTRINGs are definitely word.
POKE$$() specifies a DWORD for count. PB will put the WORD value into DWORD automagically. To be "classroom" correct in the demo I did:
MAK(DWORD, word, 0) 'where word is lower 16 bits, and 0 is the upper.


SI_Data.inc Source Code

'file SI_Data.inc
'base units  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
asmdata TimeL
 'offset to Quantity_Name always 8
  dd 18 'offset to Unit_Name 10 + size Quanity name, offset this always 0
  dd 32 'offset to Unit_Symbol 12 + sizes Quantity and Unit names, offset this always 4
  dw 4, "time" 'char count for peek$$ then string
  dw 6, "second"
  dw 1, "s"
end asmdata
asmdata LengthL
  dd 22, 62 '1st block has 2 DDs to allow comments, like this for the rest.
  dw 6, "length"
  dw 19, "meter, metre, mètre"
  dw 1, "m"
end asmdata
asmdata MassL
  dd 18, 36
  dw 4, "mass"
  dw 8, "kilogram"
  dw 2, "kg"
end asmdata
asmdata ElectricCurrentL
  dd 42, 56
  dw 16, "electric current"
  dw 6, "ampere"
  dw 1, "A"
end asmdata
asmdata ThermodynamicTemperatureL
  dd 60, 74
  dw 25, "thermodynamic temperature"
  dw 6, "kelvin"
  dw 1, "K"
end asmdata
asmdata AmountOfSubstanceL '
  dd 48, 58
  dw 19, "amount of substance"
  dw 4, "mole"
  dw 3, "mol"
end asmdata
asmdata LuminousIntensity   '#####
  dd 46, 62
  dw 18, "luminous intensity"
  dw 7, "candela"
  dw 2, "cd"
end asmdata
'derived units with special names and symbols  - - - - - - - - - - - - - - - - -
asmdata PlaneAngleL
  dd 32, 46
  dw 11, "plane angle"
  dw 6, "radian"
  dw 3, "rad"
end asmdata
asmdata SolidAngleL
  dd 32, 52
  dw 11, "solid angle"
  dw 9, "steradian"
  dw 2, "sr"
end asmdata
asmdata FrequencyL
  dd 28, 40
  dw 9, "frequency"
  dw 5, "hertz"
  dw 2, "Hz"
end asmdata
asmdata ForceWeightL
  dd 36, 50
  dw 13, "force, weight"
  dw 6, "newton"
  dw 1, "N"
end asmdata
asmdata PressureStressL '
  dd 42, 56
  dw 16, "pressure, stress"
  dw 6, "pascal"
  dw 2, "Pa"
end asmdata
asmdata EnergyWorkHeatL
  dd 46, 58
  dw 18, "energy, work, heat"
  dw 5, "joule"
  dw 1, "J"
end asmdata
asmdata PowerRadiantFluxL
  dd 48, 58
  dw 19, "power, radiant flux"
  dw 4, "watt"
  dw 1, "W"
end asmdata
asmdata ElectricChargeL
  dd 40, 56
  dw 15, "electric charge"
  dw 7, "coulomb"
  dw 1, "C"
end asmdata
asmdata ElectricPotenialVoltageEMFL
  dd 72, 82
  dw 31, "electric potenial, voltage, emf"
  dw 4, "volt"
  dw 1, "V"
end asmdata
asmdata CapacitanceL
  dd 32, 44
  dw 11, "capacitance"
  dw 5, "farad"
  dw 1, "F"
end asmdata
asmdata ResistanceImpedanceReatanceL '
  dd 72, 80
  dw 31, "resistance, impedance, reatance"
  dw 3, "ohm"
  dw 1, chr$$(&h03A9??)
end asmdata
asmdata ElectricalConductanceL
  dd 54, 100
  dw 22, "electrical conductance"
  dw 22, "siemans (formerly mho)"
  dw 25, "S (SI), ", chr$$(&h2127??), " (non-ambiguous)"
end asmdata
asmdata MagneticFluxL
  dd 36, 48
  dw 13, "magnetic flux"
  dw 5, "weber"
  dw 2, "Wb"
end asmdata
asmdata MagneticFluxDensityL
  dd 52, 64
  dw 21, "magnetic flux density"
  dw 5, "tesla"
  dw 1, "T"
end asmdata
asmdata InductanceL
  dd 30, 42
  dw 10, "inductance"
  dw 5, "henry"
  dw 1, "H"
end asmdata
asmdata TemperatureL
  dd 32, 64
  dw 11, "temperature"
  dw 15, "degrees Celsius"
  dw 2, "°C"
end asmdata
asmdata LuminousFluxL
  dd 36, 48
  dw 13, "luminous flux"
  dw 5, "lumen"
  dw 2, "lm"
end asmdata
asmdata IlluminanceL
  dd 32, 40
  dw 11, "illuminance"
  dw 3, "lux"
  dw 2, "lx"
end asmdata
asmdata RadioactiveDecaysPerSecondL
  dd 68, 88
  dw 29, "radioactive decays per second"
  dw 9, "becquerel"
  dw 2, "Bq"
end asmdata
asmdata RadiationDoseIonisingL
  dd 60, 70
  dw 25, "radiation dose (ionising)"
  dw 4, "gray"
  dw 2, "Gy"
end asmdata
asmdata RadiationEquivalentDoseL
  dd 82, 98
  dw 36, "radiation equivalent dose (Ionising)"
  dw 7, "sievert"
  dw 2, "Sv"
end asmdata
asmdata CatalyticActivityL
  dd 46, 58
  dw 18, "catalytic activity"
  dw 5, "katal"
  dw 3, "kat"
end asmdata
'Coherent Derived Units  - - - - - - - - - - - - - - - - - - - - - - - - - - - -
asmdata AreaL
  dd 18, 44
  dw 4, "area"
  dw 12, "square meter"
  dw 2, "m", chr$$(&h00B2??)
end asmdata
asmdata VolumeL
  dd 22, 46
  dw 6, "volume"
  dw 11, "cubic meter"
  dw 2, "m", chr$$(&h00B3??)
end asmdata
asmdata SpeedVelocityL
  dd 40, 76
  dw 15, "speed, velocity"
  dw 17, "meters per second"
  dw 3, "m/s"
end asmdata
asmdata AccelerationL
  dd 34, 86
  dw 12, "acceleration"
  dw 25, "meters per second squared"
  dw 4, "m/s", chr$$(&h00B2??)
end asmdata
asmdata WaveNumberVergenceL
  dd 50, 84
  dw 20, "waveNumber, vergence"
  dw 16, "reciprocal meter"
  dw 3, "m", chr$$(&h207B??, &h00B9??)
end asmdata
asmdata DensityL
  dd 24, 74
  dw 7, "density"
  dw 24, "kilogram per cubic meter"
  dw 5, "kg/m", chr$$(&h00B3??)
end asmdata
asmdata SurfaceDensityL
  dd 40, 92
  dw 15, "surface density"
  dw 25, "kilogram per square meter"
  dw 5, "kg/m", chr$$(&h00B2??)
end asmdata
asmdata SpecificVolumeL
  dd 38, 88
  dw 14, "specfic volume"
  dw 24, "cubic meter per kilogram"
  dw 5, "m", chr$$(&h00B3??), "/kg"
end asmdata
asmdata CurrentDensityL
  dd 40, 88
  dw 15, "current density"
  dw 23, "ampere per square meter"
  dw 4, "A/m", chr$$(&h00B2??)
end asmdata
asmdata MagneticFieldStrengthL
  dd 56, 90
  dw 23, "magnetic field strength"
  dw 16, "ampere per meter"
  dw 3, "A/m"
end asmdata
asmdata ConcentrationMolecularL
  dd 60, 102
  dw 25, "concentration (molecular)"
  dw 20, "mole per cubic meter"
  dw 6, "mol/m", chr$$(&h00B3??)
end asmdata
asmdata MassConcentrationL
  dd 46, 96
  dw 18, "mass concentration"
  dw 24, "kilogram per cubic meter"
  dw 5, "kg/m", chr$$(&h00B3??)
end asmdata
asmdata LuminanceL
  dd 28, 78
  dw 9, "luminance"
  dw 24, "candela per square meter"
  dw 5, "cs/m", chr$$(&h00B2??)
end asmdata
'Derived Units with special names  - - - - - - - - - - - - - - - - - - - - - - -
asmdata DynamicViscosityL
  dd 44, 72
  dw 17, "dynamic viscosity"
  dw 13, "pascal-second"
  dw 4, "Pa·s"  'Pa·s
end asmdata
asmdata MomentOfForceL
  dd 56, 82
  dw 23, "moment of force, torque"
  dw 12, "newton-meter"
  dw 3, "N·m"
end asmdata
asmdata SurfaceTensionL
  dd 40, 74
  dw 15, "surface tension"
  dw 16, "newton per meter"
  dw 3, "N/m"
end asmdata
asmdata AngularVelocityAngularFrequencyL
  dd 80, 116
  dw 35, "angular velocity, angular frequency"
  dw 17, "radian per second"
  dw 5, "rad/s"
end asmdata
asmdata AngularAccelerationL
  dd 50, 102
  dw 20, "angular acceleration"
  dw 25, "radian per second squared"
  dw 6, "rad/s", chr$$(&h00B2??)
end asmdata
asmdata HeatFluxDensityIrradianceL
  dd 68, 112
  dw 29, "heat flux density, irradiance"
  dw 21, "watt per square meter"
  dw 4, "W/m", chr$$(&h00B2??)
end asmdata
asmdata EntropyHeatCapacityL
  dd 54, 88
  dw 22, "entropy, heat capacity"
  dw 16, "joule per kelvin"
  dw 3, "J/K"
end asmdata
asmdata SpecificHeatCapacitySpecificEntropyL
  dd 90, 142
  dw 40, "specific heat capacity, specific entropy"
  dw 25, "joule per kilogram-kelvin"
  dw 8, "J/(kg·K)"
end asmdata
asmdata SpecificEnergyL
  dd 40, 78
  dw 15, "specific energy"
  dw 18, "joule per kilogram"
  dw 4, "J/kg"
end asmdata
asmdata ThermalConductivityL
  dd 50, 94
  dw 20, "thermal conductivity"
  dw 21, "watt per meter-kelvin"
  dw 7, "W/(m·K)"
end asmdata
asmdata EnergyDensityL
  dd 38, 82
  dw 14, "energy density"
  dw 21, "joule per cubic metre"
  dw 4, "J/m", chr$$(&h00B3??)
end asmdata
asmdata ElectricFieldStrengthL
  dd 56, 86
  dw 23, "electric field strength"
  dw 14, "volt per meter"
  dw 3, "V/m"
end asmdata
asmdata ElectricChargeDensityL
  dd 56, 104
  dw 23, "electric charge density"
  dw 23, "coulomb per cubic meter"
  dw 4, "C/m", chr$$(&h00B3??)
end asmdata
asmdata SurfaceChargeDensityElectricFluxDensityL
  dd 116, 166
  dw 53, "surface charge, electric flux density or displacement"
  dw 24, "coulomb per square meter"
  dw 4, "C/m", chr$$(&h00B2??)
end asmdata
asmdata PermittivityL
  dd 34, 66
  dw 12, "permittivity"
  dw 15, "farad per meter"
  dw 3, "F/m"
end asmdata
asmdata PermeabilityL
  dd 34, 66
  dw 12, "permeability"
  dw 15, "henry per meter"
  dw 3, "H/m"
end asmdata
asmdata MolarEnergyL
  dd 34, 64
  dw 12, "molar energy"
  dw 14, "joule per mole"
  dw 5, "J/mol"
end asmdata
asmdata MolarEntropyMolarHeatCapacityL
  dd 78, 122
  dw 34, "molar entropy, molar heat capacity"
  dw 21, "joule per mole-kelvin"
  dw 9, "J/(mol·K)"
end asmdata
asmdata ExposureL
  dd 58, 100
  dw 24, "exposure (x- and ", chr$$(&h03B3??), "-rays)"
  dw 20, "coulomb per kilogram"
  dw 4, "C/kg"
end asmdata
asmdata AbsorbedDoseRateL
  dd 46, 78
  dw 18, "absorbed dose rate"
  dw 15, "gray per second"
  dw 4, "Gy/s"
end asmdata
asmdata RadiantIntensityL
  dd 44, 82
  dw 17, "radiant intensity"
  dw 18, "watt per steradian"
  dw 4, "W/sr"
end asmdata
asmdata RadianceL
  dd 26, 90
  dw 8, "radiance"
  dw 31, "watt per square meter-steradian"
  dw 9, "W/(m", chr$$(&h00B2??), "·sr)"
end asmdata
asmdata CatalyticActivityConcentrationL
  dd 74, 118
  dw 32, "catalytic activity concentration"
  dw 21, "katal per cubic meter"
  dw 6, "kat/m", chr$$(&h00B3??)
end asmdata


PBWin SI Unit Lookup Demo Description

(Good time to mention:)
In BASIC it is customary to put key words in upper case. In the IDE with the key words in color and upper case it was harder (for me) to see the procdure and variable names in black mixed case. Me working in the IDE trumps custom here. If you copy the code from here and paste into your IDE, it will be in the case and colors you've set. This is not my IDE, so I'll use all upper case when using key words in text.
Also note that the name of the computer language BASIC is an acronym, so is upper case too.
Define equates.
Help suggests starting at 100, I like 1000. That way hundred groups may be used for different groups of controls without running out of IDs. Thousand groups used for multiple dialogs/windows. ID numbers can be reused for different dialogs/windows without interference, but there are lots of numbers that don't cost anything ☻.
Include file.
Discussed above.
Load Combo Box SUB
Clear the COMBOBOX and TEXTBOXes.
Only important if OPTION is changed during run.
Add item to COMBOBOX for an ASMDATA block.
Get an address pointer for each block by label.
GOSUB avoids repeating code for each block.
Repeat for each label.
EXIT SUB
With this the program flow jumps to END SUB. Otherwise, the subroutine code will execute again with last data, and have nowhere to RETURN to. Not a big disaster here, could be serious in other programs.
Subroutine ComboBxItem:
Depending on the FromID, set by OPTION control, pointers are set and character count is read in the SELECT CASE. The string is added to the COMBOBOX list, block label address stored in item USER location, and FromID in a CONTROL USER location.
CALLBACK
For decode of Windows messages (%WM_) I suggest SELECT CASE AS LONG CB.MSG It performs better than the floating version. The messages you're looking for won't waste code space by not being sequencial like AS CONST would. AS CONST is good for selecting controls if the ID numbers aren't "spred out". In this program I only need to catch %WM_COMMAND, so an IF/THEN is used instead of a SELECT CASE.
The first three CASEs are for Option clicks to load the COMBOBOX and set the LABELs over the result TEXTBOXes.
The fourth CASE is for COMBOBOX selection and putting results in the TEXTBOXes.
PBMAIN
Here, just create the DIALOG, add CONTROLs and SHOW it.
DIALOG DEFAULT FONT
The default size of 8pt (pt = point) is the lower limit for "regular" reading (IMO). 10pt is okay (at my age); but superscript, subscript and some special characters are very small. This program uses superscript in unit symbols so I set to 12pt. Individual controls can be set to other font faces and sizes as needed. (Just in case - points are the height of characters, and 1pt = 1/72 inch.)
UTF-16, referred to as WIDE in PB, is Windows standard. I suggest you use WSTRING, WSTRINGZ and WSTRING * x for all text. 8 bit per character STRINGs will still see use for text in UTF-8, DIBs (images) and passing binary numeric types to/from COMM, TCP and UDP.
Be sure to choose a font face that contains the characters you need to use. I chose Microsoft Sans Serif. It is a Unicode font having a lot of characters. Some Unicode fonts are less complete. The point is to avoid ANSI (8 bit) fonts, in this case MS Sans Serif (also by Microsoft, but old).
DIALOG NEW
I wanted %WS_SYSMENU for the "X" close button and to use %WS_MINIMIZEBOX. Full screen didn't make sense, so left out %WS_MAXIMIZEBOX. The default styles I did want had to be ORed in as well.
ADD OPTION buttons.
The first gets %WS_GROUP and the default styles to make the three OPTIONs a group. for tabbing to select focus.
ADD FRAME
Gets %WS_GROUP to end the group. %WS_TABSTOP is not even listed as a style for a FRAME so no useless focus set.
ADD COMBOBOX
The are the default styles plus %CBS_DISABLENOSCROLL, %CBS_HASSTRINGS, %CBS_NOINTEGRALHEIGHT (use control height I specify, even if it horizontally cuts a line of text) and (actually OR ☺) %WS_VSCROLL.
%CBS_SORT was originally left out to make testing and troubleshooting the ASMDATAs in the include file easier.
ADD LABELs and ADD TEXTBOXes
Lookup results placed in these TEXTBOXes in the CALLBACK.
DIALOG SHOW
Also about as simple as it gets.


PBWin SI Lookup Demo Source Code

'Copyleft (ɔ) 2022 by Dale Yarker; do what you want with this code except claim it,
'or sell it, as yours. No warranty of any kind.
#compile exe
#dim all
'selected in callback, (better) allows SELECT CASE AS CONST rather than AS LONG
%ID_FromQuantityOpt = 1001
%ID_FromUnitOpt     = 1002
%ID_FromSymbolOpt   = 1003
%ID_OptionFrame     = 1004
%ID_PickCBx         = 1005
'not selected in callback, need IDs to modify these controls
%ID_ResultALbl   = 1101
%ID_ResultATxtBx = 1102
%ID_ResultBLbl   = 1103
%ID_ResultBTxtBx = 1104
'used in load and callback of combobox, again sequential for AS CONST
%FromQuantName  = 1&
%FromUnitName   = 2&
%FromSymbolName = 3&
#include "./SI_Data.inc"
sub LoadComboBox(byval hMainDlg as dword, byval FromID as long) as long
  local pSI_Item, pItemCharCnt, ItemCharCnt, pItemStr, ItemOffset as dword
  local CBIdx as long
  combobox reset hMainDlg, %ID_PickCBx
  control set text hMainDlg, %ID_ResultATxtBx, ""
  control set text hMainDlg, %ID_ResultBTxtBx, ""
  pSI_Item = codeptr(AbsorbedDoseRateL) : gosub ComboBxItem
  pSI_Item = codeptr(AccelerationL) : gosub ComboBxItem
  pSI_Item = codeptr(AmountOfSubstanceL) : gosub ComboBxItem
  pSI_Item = codeptr(AngularAccelerationL) : gosub ComboBxItem
  pSI_Item = codeptr(AngularVelocityAngularFrequencyL) : gosub ComboBxItem
  pSI_Item = codeptr(AreaL) : gosub ComboBxItem
  pSI_Item = codeptr(CapacitanceL) : gosub ComboBxItem
  pSI_Item = codeptr(CatalyticActivityL) : gosub ComboBxItem
  pSI_Item = codeptr(CatalyticActivityConcentrationL) : gosub ComboBxItem
  pSI_Item = codeptr(ConcentrationMolecularL) : gosub ComboBxItem
  pSI_Item = codeptr(CurrentDensityL) : gosub ComboBxItem
  pSI_Item = codeptr(DensityL) : gosub ComboBxItem
  pSI_Item = codeptr(DynamicViscosityL) : gosub ComboBxItem
  pSI_Item = codeptr(ElectricChargeL) : gosub ComboBxItem
  pSI_Item = codeptr(ElectricChargeDensityL) : gosub ComboBxItem
  pSI_Item = codeptr(ElectricalConductanceL) : gosub ComboBxItem
  pSI_Item = codeptr(ElectricCurrentL) : gosub ComboBxItem
  pSI_Item = codeptr(ElectricFieldStrengthL) : gosub ComboBxItem
  pSI_Item = codeptr(ElectricPotenialVoltageEMFL) : gosub ComboBxItem
  pSI_Item = codeptr(EnergyDensityL) : gosub ComboBxItem
  pSI_Item = codeptr(EnergyWorkHeatL) : gosub ComboBxItem
  pSI_Item = codeptr(EntropyHeatCapacityL) : gosub ComboBxItem
  pSI_Item = codeptr(ExposureL) : gosub ComboBxItem
  pSI_Item = codeptr(ForceWeightL) : gosub ComboBxItem
  pSI_Item = codeptr(FrequencyL) : gosub ComboBxItem
  pSI_Item = codeptr(HeatFluxDensityIrradianceL) : gosub ComboBxItem
  pSI_Item = codeptr(IlluminanceL) : gosub ComboBxItem
  pSI_Item = codeptr(InductanceL) : gosub ComboBxItem
  pSI_Item = codeptr(LengthL) : gosub ComboBxItem
  pSI_Item = codeptr(LuminanceL) : gosub ComboBxItem
  pSI_Item = codeptr(LuminousFluxL) : gosub ComboBxItem
  pSI_Item = codeptr(LuminousIntensity) : gosub ComboBxItem
  pSI_Item = codeptr(MagneticFieldStrengthL) : gosub ComboBxItem
  pSI_Item = codeptr(MagneticFluxL) : gosub ComboBxItem
  pSI_Item = codeptr(MagneticFluxDensityL) : gosub ComboBxItem
  pSI_Item = codeptr(MassL) : gosub ComboBxItem
  pSI_Item = codeptr(MassConcentrationL) : gosub ComboBxItem
  pSI_Item = codeptr(MolarEnergyL) : gosub ComboBxItem
  pSI_Item = codeptr(MolarEntropyMolarHeatCapacityL) : gosub ComboBxItem
  pSI_Item = codeptr(MomentOfForceL) : gosub ComboBxItem
  pSI_Item = codeptr(PermeabilityL) : gosub ComboBxItem
  pSI_Item = codeptr(PermittivityL) : gosub ComboBxItem
  pSI_Item = codeptr(PlaneAngleL) : gosub ComboBxItem
  pSI_Item = codeptr(PowerRadiantFluxL) : gosub ComboBxItem
  pSI_Item = codeptr(PressureStressL) : gosub ComboBxItem
  pSI_Item = codeptr(RadianceL) : gosub ComboBxItem
  pSI_Item = codeptr(RadiantIntensityL) : gosub ComboBxItem
  pSI_Item = codeptr(RadiationDoseIonisingL) : gosub ComboBxItem
  pSI_Item = codeptr(RadiationEquivalentDoseL) : gosub ComboBxItem
  pSI_Item = codeptr(RadioactiveDecaysPerSecondL) : gosub ComboBxItem
  pSI_Item = codeptr(ResistanceImpedanceReatanceL) : gosub ComboBxItem
  pSI_Item = codeptr(SpecificEnergyL) : gosub ComboBxItem
  pSI_Item = codeptr(SpecificHeatCapacitySpecificEntropyL) : gosub ComboBxItem
  pSI_Item = codeptr(SpecificVolumeL) : gosub ComboBxItem
  pSI_Item = codeptr(SpeedVelocityL) : gosub ComboBxItem
  pSI_Item = codeptr(SolidAngleL) : gosub ComboBxItem
  pSI_Item = codeptr(SurfaceChargeDensityElectricFluxDensityL) : gosub ComboBxItem
  pSI_Item = codeptr(SurfaceDensityL) : gosub ComboBxItem
  pSI_Item = codeptr(SurfaceTensionL) : gosub ComboBxItem
  pSI_Item = codeptr(TemperatureL) : gosub ComboBxItem
  pSI_Item = codeptr(ThermalConductivityL) : gosub ComboBxItem
  pSI_Item = codeptr(ThermodynamicTemperatureL) : gosub ComboBxItem
  pSI_Item = codeptr(TimeL) : gosub ComboBxItem
  pSI_Item = codeptr(VolumeL) : gosub ComboBxItem
  pSI_Item = codeptr(WaveNumberVergenceL) : gosub ComboBxItem
  '
  exit sub 'don't "fall" into subroutine when done  - - - - - - - - - - - -
  ComboBxItem:
    select case as const FromID
      case %FromQuantName
        pItemCharCnt = pSI_Item + 8???
        ItemCharCnt = mak(dword, peek(word, pItemCharCnt), 0??)
        pItemStr = pSI_Item + 10???
      case %FromUnitName
        ItemOffset = peek(dword, pSI_Item)
        pItemCharCnt = ItemOffset + pSI_Item
        ItemCharCnt = mak(dword, peek(word, pItemCharCnt), 0??)
        pItemStr = pItemCharCnt + 2???
      case %FromSymbolName
        ItemOffset = peek(dword, (pSI_Item + 4))
        pItemCharCnt = ItemOffset + pSI_Item
        ItemCharCnt = mak(dword, peek(word, pItemCharCnt), 0??)
        pItemStr = pItemCharCnt + 2???
    end select
    combobox add hMainDlg, %ID_PickCBx, peek$$(pItemStr, ItemCharCnt) to CBIdx
    combobox set user hMainDlg, %ID_PickCBx, CBIdx, pSI_Item
    control set user hMainDlg,%ID_PickCBx, 1, FromID
  return
end sub
callback function MainDlgCB() as long
  local FromID, ItemIdx as long
  local pSI_Item, ItemOffset, pSI_ItemStr, ItemCharCnt as dword
  if cb.msg = %wm_command then
    select case as const cb.ctl
      case %ID_FromQuantityOpt
        if cb.ctlmsg = %bn_clicked then
          LoadComboBox cb.hndl, %FromQuantName
          control set text cb.hndl, %ID_ResultALbl, "Unit Name"
          control set text cb.hndl, %ID_ResultBLbl, "Symbol"
        end if
      case %ID_FromUnitOpt
        if cb.ctlmsg = %bn_clicked then
          LoadComboBox cb.hndl, %FromUnitName
          control set text cb.hndl, %ID_ResultALbl, "Quantity Name"
          control set text cb.hndl, %ID_ResultBLbl, "Symbol"
        end if
      case %ID_FromSymbolOpt
        if cb.ctlmsg = %bn_clicked then
          LoadComboBox cb.hndl, %FromSymbolName
          control set text cb.hndl, %ID_ResultALbl, "Quantity Name"
          control set text cb.hndl, %ID_ResultBLbl, "Unit Name"
        end if
      case %ID_PickCBx
        if cb.ctlmsg = %cbn_selchange then
          control get user cb.hndl, %ID_PickCBx, 1 to FromID
          combobox get select cb.hndl, %ID_PickCBx to ItemIdx
          combobox get user cb.hndl, %ID_PickCBx, ItemIdx to pSI_Item
          select case as const FromID
            case %FromQuantName
              ItemOffset = peek(dword, pSI_Item)
              pSI_ItemStr = pSI_Item + ItemOffset
              ItemCharCnt = mak(dword, peek(word, pSI_ItemStr), 0??)
              pSI_ItemStr += 2
              control set text cb.hndl, %ID_ResultATxtBx, _
                 peek$$(pSI_ItemStr, ItemCharCnt)
              ItemOffset = peek(dword, (pSI_Item + 4))
              pSI_ItemStr = pSI_Item + ItemOffset
              ItemCharCnt = peek(word, pSI_ItemStr)
              pSI_ItemStr += 2
              control set text cb.hndl, %ID_ResultBTxtBx, _
                 peek$$(pSI_ItemStr, ItemCharCnt)
            case %FromUnitName
              ItemOffset = 8???
              pSI_ItemStr = pSI_Item + ItemOffset
              ItemCharCnt = mak(dword, peek(word, pSI_ItemStr), 0??)
              pSI_ItemStr += 2
              control set text cb.hndl, %ID_ResultATxtBx, _
                 peek$$(pSI_ItemStr, ItemCharCnt)
              ItemOffset = peek(dword, (pSI_Item + 4))
              pSI_ItemStr = pSI_Item + ItemOffset
              ItemCharCnt = peek(word, pSI_ItemStr)
              pSI_ItemStr += 2
              control set text cb.hndl, %ID_ResultBTxtBx, _
                 peek$$(pSI_ItemStr, ItemCharCnt)
            case %FromSymbolName
              ItemOffset = 8???
              pSI_ItemStr = pSI_Item + ItemOffset
              ItemCharCnt = mak(dword, peek(word, pSI_ItemStr), 0??)
              pSI_ItemStr += 2
              control set text cb.hndl, %ID_ResultATxtBx, _
                 peek$$(pSI_ItemStr, ItemCharCnt)
              ItemOffset = peek(dword, pSI_Item )
              pSI_ItemStr = pSI_Item + ItemOffset
              ItemCharCnt = peek(word, pSI_ItemStr)
              pSI_ItemStr += 2
              control set text cb.hndl, %ID_ResultBTxtBx, _
                 peek$$(pSI_ItemStr, ItemCharCnt)
          end select
        end if
    end select
  end if
end function
function pbmain () as long
  local hMainDlg as dword
  dialog default font "Microsoft Sans Serif", 12, 0, 1
  dialog new 0, "SI Unit Names, Quanities And Symbols", , , 188, 120, _
     %ds_3dlook or %ds_modalframe or %ds_nofailcreate or %ds_setfont or _
     %ws_caption or %ws_clipsiblings or %ws_dlgframe or %ws_minimizebox or _
     %ws_popup or %ws_sysmenu, _
     %ws_ex_left or %ws_ex_ltrreading or %ws_ex_rightscrollbar to hMainDlg
  control add option, hMainDlg, %ID_FromQuantityOpt, "From Quantity Name", _
     8, 12, 76, 11, _
     %bs_left or %bs_vcenter or %ws_group or %ws_tabstop, %ws_ex_left
  control add option, hMainDlg, %ID_FromUnitOpt, "From Unit Name", _
     8, 23, 75, 11
  control add option, hMainDlg, %ID_FromSymbolOpt, "From Symbol", _
     8, 34, 75, 11
  control add frame, hMainDlg, %ID_OptionFrame, "Find Name Or Symbol", _
     5, 3, 82, 45, %bs_left or %ws_group, %ws_ex_left
  control add combobox, hMainDlg, %ID_PickCBx, , 5, 53, 180, 60, _
     %cbs_disablenoscroll or %cbs_dropdown or %cbs_hasstrings or %cbs_sort or _
     %cbs_nointegralheight or %ws_group or %ws_tabstop or %ws_vscroll, _
     %ws_ex_clientedge or %ws_ex_left
  control add label, hMainDlg, %ID_ResultALbl, "", 6, 70, 100, 9
  control add textbox, hMainDlg, %ID_ResultATxtBx, "", 5, 79, 172 , 11
  control add label, hMainDlg, %ID_ResultBLbl, "", 6, 95, 100, 9
  control add textbox, hMainDlg, %ID_ResultBTxtBx, "", 5, 104, 172, 11
  '
  dialog show modal hMainDlg call MainDlgCB
end function


Page created 6 Dec 2022.
To Domain Home.

home
To Dale's Notebook index.
notebook
To Programs index.
programs