local useGroupMenu = true local extGroupMenuCaption = 'Extra Extensions' local extItemCaption = 'Hex,Dec Calculator' local mf = getMainForm() local mm = mf.Menu local extMenu = nil --GUI elements start local form = createForm(false) form.Height = 300; form.Width = 300; form.Caption = 'Hex,Dec Calculator'; form.Constraints.MinHeight = 300; form.Constraints.MinWidth = 300; form.BorderStyle = bsSingle form.Position = poScreenCenter form.PopupMode=0 local read = createPanel(form) read.Align = alLeft read.Width = 300 read.BevelOuter = bvNone local hex = createCheckBox(read) hex.AnchorSideLeft.Control = read hex.AnchorSideTop.Control = read hex.BorderSpacing.Left = 10 hex.BorderSpacing.Top = 10 hex.Caption = 'Show in hex' local dec = createCheckBox(read) dec.AnchorSideLeft.Control = read dec.AnchorSideTop.Control = read dec.BorderSpacing.Left = 10 dec.BorderSpacing.Top = 30 dec.Caption = 'Show in dec' local editText = createLabel(read) editText.AnchorSideLeft.Control = read editText.AnchorSideTop.Control = read editText.BorderSpacing.Left = 10 editText.BorderSpacing.Top = 90 editText.Caption = 'Address or value' local editBox = createEdit(read) editBox.AnchorSideLeft.Control = read editBox.AnchorSideTop.Control = read editBox.Width = 100 editBox.BorderSpacing.Left = 10 editBox.BorderSpacing.Top = 110 editBox.Text = '' local convertButton = createButton(read) convertButton.AnchorSideLeft.Control = read convertButton.AnchorSideTop.Control = read convertButton.BorderSpacing.Left = 10 convertButton.BorderSpacing.Top = 140 convertButton.Caption = 'Convert' local result = createLabel(read) result.AnchorSideLeft.Control = read result.AnchorSideTop.Control = read result.BorderSpacing.Left = 10 result.BorderSpacing.Top = 180 result.Caption = ' ' local copyButton = createButton(read) copyButton.AnchorSideLeft.Control = read copyButton.AnchorSideTop.Control = read copyButton.BorderSpacing.Left = 10 copyButton.BorderSpacing.Top = 60 copyButton.Width = 175 copyButton.Caption = 'Copy result to clipboard' local infoButton = createButton(read) infoButton.AnchorSideLeft.Control = read infoButton.AnchorSideTop.Control = read infoButton.BorderSpacing.Left = 10 infoButton.BorderSpacing.Top = 210 infoButton.Caption = 'Info' local infoForm = createForm(false) infoForm.Height = 300; infoForm.Width = 300; infoForm.Caption = 'Info'; infoForm.Constraints.MinHeight = 300; infoForm.Constraints.MinWidth = 300; infoForm.BorderStyle = bsSingle infoForm.Position = poScreenCenter infoForm.PopupMode=0 local infoFormPanel = createPanel(infoForm) infoFormPanel.Align = alLeft infoFormPanel.Width = 300 infoFormPanel.BevelOuter = bvNone local hexUsage = createLabel(infoFormPanel) hexUsage.AnchorSideLeft.Control = infoFormPanel hexUsage.AnchorSideTop.Control = infoFormPanel hexUsage.BorderSpacing.Left = 10 hexUsage.BorderSpacing.Top = 10 hexUsage.Caption = 'IF Hex:Type a value you need' local decUsage = createLabel(infoFormPanel) decUsage.AnchorSideLeft.Control = infoFormPanel decUsage.AnchorSideTop.Control = infoFormPanel decUsage.BorderSpacing.Left = 10 decUsage.BorderSpacing.Top = 30 decUsage.Caption = 'IF Dec:Type like this 0xYourValue' local decUsage2 = createLabel(infoFormPanel) decUsage2.AnchorSideLeft.Control = infoFormPanel decUsage2.AnchorSideTop.Control = infoFormPanel decUsage2.BorderSpacing.Left = 10 decUsage2.BorderSpacing.Top = 50 decUsage2.Caption = 'Replace YourValue with your value' --GUI elements end --Form settings start form.Cursor = crCross read.Cursor = crCross infoForm.Cursor = crHelp infoFormPanel.Cursor = crHelp editBox.Enabled = false; form.OnClose = function(sender) result.Caption = ' ' editBox.Text = ' ' dec.Checked = false; hex.Checked = false return caHide end copyButton.OnClick = function(sender) copyText = result.Caption sleep(1) writeToClipboard(copyText) end hex.OnChange = function(sender) if sender.Checked then dec.Enabled = not sender.Checked editBox.Enabled = sender.Checked end if not sender.Checked then dec.Enabled = not sender.Checked editBox.Enabled = sender.Checked end end dec.OnChange = function(sender) if sender.Checked then hex.Enabled = not sender.Checked editBox.Enabled = sender.Checked end if not sender.Checked then hex.Enabled = not sender.Checked editBox.Enabled = sender.Checked end end convertButton.OnClick = function(sender) if dec.Enabled == true and hex.Enabled == true then beep() showMessage('Can\'t convert the value,chose value type to convert!') end local editNumber = editBox.Text if dec.Checked == true then local resultText = string.format('%d',editBox.Text) result.Caption = resultText end if hex.Checked == true then local resultText = string.format('0x%X',editBox.Text) result.Caption = resultText end end infoButton.OnClick = function(sender) local infoMenu = createMainMenu(infoForm) infoForm.show() end infoForm.OnClose = function(sender) return caHide end --Form settings end --Group menu elements start if useGroupMenu then for i=0,mm.Items.Count-1 do if mm.Items.Item[i].Caption == extGroupMenuCaption then extMenu = mm.Items.Item[i] break end end if not extMenu then extMenu = createMenuItem(mm) extMenu.Caption = extGroupMenuCaption mm.Items.add(extMenu) end else extMenu = mm.Items end local extMenuItem = createMenuItem(extMenu) extMenuItem.Caption = extItemCaption extMenu.add(extMenuItem) --Group menu elements end --Main functions start --Main functions end --Group menu start extMenuItem.OnClick = function(sender) local mainMenu = createMainMenu(form) form.show() end --Group menu end