BabyCE=createPanel(MainForm.Panel5) BabyCE.AnchorSideTop.Control=MainForm.foundcountlabel BabyCE.AnchorSideTop.Side=asrBottom BabyCE.AnchorSideLeft.Control=MainForm.FoundList3 BabyCE.AnchorSideLeft.Side=asrRight BabyCE.AnchorSideRight.Control=MainForm.Panel5 BabyCE.AnchorSideRight.Side=asrRight BabyCE.AnchorSideBottom.Control=MainForm.FoundList3 BabyCE.AnchorSideBottom.Side=asrBottom BabyCE.BevelOuter='bvNone' BabyCE.Caption='' BabyCE.Font.Size=15 BabyCE.Anchors="[akLeft,akRight,akTop,akBottom]" BabyCE.DoState={} BabyCE.UpdateState=function(newstate) BabyCE.State=newstate --clear the screen while BabyCE.ComponentCount>0 do BabyCE.Component[0].destroy() end BabyCE.DoState[newstate]() end --------------------------------------------------- ------------STAGE ALPHA START---------------------- --------------------------------------------------- --BabyCE.DoState[3]=function() local edtValue local edtValue2 local hasOptions=false local startScan=function() --start the scan if edtValue then MainForm.ScanValue.Text=edtValue.Text end if edtValue2 then MainForm.ScanValue2.Text=edtValue2.Text end local t=createTimer() --for some reason this is needed... t.Interval=1 t.OnTimer=function(t) t.destroy() BabyCE.UpdateState(4) --select scan options end end local hint=createLabel(BabyCE) hint.Caption=MainForm.ScanType.Text hint.align="alTop" hint.Alignment="taCenter" buttonPanel=createPanel(BabyCE) buttonPanel.align="alClient" buttonPanel.BevelOuter="bvNone" buttonPanel.Caption="" buttonPanel.ChildSizing.Layout="cclLeftToRightThenTopToBottom" buttonPanel.ChildSizing.ControlsPerLine=1 buttonPanel.ChildSizing.HorizontalSpacing=4 buttonPanel.ChildSizing.VerticalSpacing=64 buttonPanel.ChildSizing.EnlargeHorizontal="crsScaleChilds" buttonPanel.BorderWidth=4 if MainForm.ScanValue.Visible then hasOptions=true edtValue=createComponentClass("TEdit",buttonPanel) --using a TEdit since it has a nice TextHint property edtValue.parent=buttonPanel edtValue.TextHint="Value to scan" edtValue.Text=MainForm.ScanValue.Text if edtValue.Text~='' then edtValue.selectAll() end edtValue.setFocus() end if MainForm.ScanValue2.Visible then buttonPanel.ChildSizing.ControlsPerLine=3 andLabel=createComponentClass("TLabel",buttonPanel) andLabel.caption=MainForm.andlabel.caption andLabel.parent=buttonPanel andLabel.Alignment='taCenter' edtValue2=createComponentClass("TEdit",buttonPanel) edtValue2.parent=buttonPanel edtValue2.TextHint="Value to scan" edtValue2.Text=MainForm.ScanValue2.Text MainForm.ScanValue2.sendToBack() --for some reason it pops up over BabyCE end --start the scan if hasOptions then --create a button to start the scan btnStartScan=createButton(buttonPanel) btnStartScan.Caption="Scan" btnStartScan.OnClick=startScan --not a direct child btnStartScan.AnchorSideTop.Control=edtValue btnStartScan.AnchorSideTop.Side=asrBottom btnStartScan.BorderSpacing.Top=64 btnStartScan.AnchorSideLeft.Control=buttonPanel btnStartScan.AnchorSideLeft.Side=asrLeft btnStartScan.AnchorSideRight.Control=buttonPanel btnStartScan.AnchorSideRight.Side=asrRight btnStartScan.Anchors="[akLeft, akTop, akRight]" btnStartScan.Font.Size=24 btnStartScan.Font.Style="[fsBold]" btnStartScan.AutoSize=true btnStartScan.Default=true local btnBack=createButton(BabyCE) btnBack.AnchorSideRight.Control=BabyCE btnBack.AnchorSideRight.Side=asrRight btnBack.AnchorSideBottom.Control=BabyCE btnBack.AnchorSideBottom.Side=asrBottom btnBack.Anchors="[akBottom,akRight]" btnBack.Caption="Back" btnBack.AutoSize=true btnBack.OnClick=function(s) local t=createTimer() --for some reason this is needed... t.Interval=1 t.OnTimer=function(t) t.destroy() BabyCE.UpdateState(2) --select scan options end end else startScan() end BabyCE.DoState[4]=function() local hint=createLabel(BabyCE) hint.Caption=MainForm.ScanType.Text.." scan in progress. Please wait" hint.WordWrap=true hint.align="alTop" hint.Alignment="taCenter" getCurrentMemscan().OnScanDone=function() BabyCE.UpdateState(2) --scan options end if MainForm.btnNextScan.Enabled then MainForm.btnNextScan.doClick() else MainForm.btnNewScan.doClick() end BabyCE.bringToFront() --now wait till the scan is done, and capture errors... end --end --------------------------------------------------- ------------STAGE ALPHA ENDS----------------------- --------------------------------------------------- --------------------------------------------------- ------------STAGE BETA STARTS---------------------- --------------------------------------------------- --BabyCE.DoState[2]=function() --scan options local hint=createLabel(BabyCE) local btnClick=function(b) MainForm.ScanType.ItemIndex=b.tag MainForm.ScanType.OnChange(MainForm.ScanType) local t=createTimer() --for some reason this is needed... t.Interval=1 t.OnTimer=function(t) t.destroy() BabyCE.UpdateState(3) --select scan options end end hint.Caption="Choose your scan options" hint.align="alTop" hint.Alignment="taCenter" --parse the scan options from the MainForm.ScanType buttonPanel=createPanel(BabyCE) buttonPanel.align="alClient" buttonPanel.BevelOuter="bvNone" buttonPanel.Caption="" buttonPanel.ChildSizing.Layout="cclLeftToRightThenTopToBottom" buttonPanel.ChildSizing.ControlsPerLine=2 buttonPanel.ChildSizing.HorizontalSpacing=4 buttonPanel.ChildSizing.VerticalSpacing=4 buttonPanel.ChildSizing.EnlargeHorizontal="crsHomogenousChildResize" local i local items=MainForm.ScanType.Items for i=0,items.Count-1 do local btn=createButton(buttonPanel) btn.Caption=items[i] btn.Tag=i btn.OnClick=btnClick end --check that all the buttons are visible, else shrink the foundlist local cw=buttonPanel.ClientWidth local maxX=cw; for i=0,buttonPanel.ComponentCount-1 do local x,w x=buttonPanel.Component[i].Left w=buttonPanel.Component[i].Width if (x+w)>maxX then maxX=x+w end end if maxX>cw then MainForm.FoundList3.Width=MainForm.FoundList3.Width-(maxX-cw) end buttonPanel.Component[MainForm.ScanType.ItemIndex].setFocus() if MainForm.btnNextScan.Enabled then MainForm.foundlistpopup.OnPopup(MainForm.foundlistpopup) if MainForm.miForgotScan.visible and MainForm.miForgotScan.enabled then local btnForgotScan=createButton(buttonPanel) btnForgotScan.Caption='Forgot/Reload' btnForgotScan.Hint="Click this if you forgot what the previous scan was" btnForgotScan.ShowHint=true btnForgotScan.OnClick=function(s) MainForm.miForgotScan.doClick() --the OnScanDone is already configured to go to state 2 end end end local newScan=createButton(BabyCE) newScan.AnchorSideRight.Control=BabyCE newScan.AnchorSideRight.Side=asrRight newScan.AnchorSideBottom.Control=BabyCE newScan.AnchorSideBottom.Side=asrBottom newScan.Anchors="[akBottom,akRight]" newScan.Caption="New scan" newScan.AutoSize=true newScan.OnClick=function(s) if messageDialog("Are you sure? Your current scan results will be erased",mtConfirmation,mbYes,mbNo)==mrYes then MainForm.btnNewScan.doClick() local t=createTimer() --for some reason this is needed... t.Interval=1 t.OnTimer=function(t) t.destroy() BabyCE.UpdateState(1) --select scan options end end end --end --------------------------------------------------- ------------STAGE BETA ENDS------------------------ ---------------------------------------------------