Ready-to-use Code ExampleSettingDialogSliderCheckboxvisibleWhensetSurfacesetSurfaceStylestyleField

Dialog: Advanced Authoring and Sections

Shows dialog size and orientation, vertical/horizontal sections, conditional fields, and field/button styling in one production-oriented example.

Copyable Example Code

You can paste this into the code editor; still verify target image, region, color, text, and timing values in your own device flow.

-- Gelismis Dialog tasarimi / Advanced Dialog authoring
local cfg = Setting.builder()
cfg:setTitle("Automation Control")
cfg:setPositiveButton("Apply")
cfg:setNegativeButton("Cancel")

-- Dialog yonu cihaz yonunden bagimsiz secilebilir.
cfg:setSurface("landscape", 760, 440)
cfg:setSurfaceStyle("rounded")
cfg:setPositiveButtonStyle("#FFFFFF", "#18B968", "#10944F", 12, 48)
cfg:setNegativeButtonStyle("#FFFFFF", "#1E293B", "#EF4444", 12, 48)

-- Dikey bolum: ayrintili ayarlar.
cfg:group("connection", "Connection", "vertical")
cfg:add("advanced", Checkbox(false, "Advanced settings"))
cfg:add(
  "endpoint",
  EditText("https://api.example.com", 1, "Endpoint")
    :required(true)
    :visibleWhen("advanced", true, true)
)
cfg:add(
  "retry",
  Slider("3", "Retry count", "1", "10")
    :visibleWhen("advanced", true, true)
)
cfg:groupEnd()

-- Yatay bolum: kompakt secenekler.
cfg:group("quick_actions", "Quick actions", "horizontal")
cfg:add("dryRun", Checkbox(false, "Dry run"))
cfg:add("notify", Checkbox(true, "Notify"))
cfg:groupEnd()

cfg:styleField(
  "endpoint",
  "#38BDF8",
  "#E2E8F0",
  "#22C55E",
  "#0B1220",
  "#1E3A5F"
)

local dialog = cfg:build()
-- Tasarimi kaydetmeden once ayni renderer ile kontrol edin:
-- dialog:preview()
local result = dialog:show()
if type(result) ~= "table" then return end

toast(
  "Dry run: " .. tostring(result["dryRun"] == true) ..
  ", retry: " .. tostring(result["retry"] or "3")
)

Implementation and Adaptation Notes

  • Before running, replace sample values such as image names, text, colors, coordinates, and file paths with your own macro values.
  • For examples that use Region or coordinates, retest the target area on different resolutions and DPI values.
  • Tune mScore, timeout, and scan rate in a test macro first, then move the verified values into the production macro.