SithasoDaisyUIKit workspace findings (updated: 2026-02-16)
1) Register new modules in B4A project file
- When adding new .bas modules under B4A, also update B4A/SithasoDaisyUIKit.b4a:
- Add ModuleN entries.
- Increment NumberOfModules.
- Symptom if missed:
- "Unknown type: <classname>" during compile/parse.
2) HorizontalScrollView Initialize signature in B4A
- Correct order: HorizontalScrollView.Initialize(PanelHeight, EventName)
- Example:
- hsv.Initialize(0, "hsv")
- Common mistake:
- hsv.Initialize("hsv", 0) -> runtime NumberFormatException ("For input string: \"hsv\"").
3) install.ps1 validation
- Do not trust BUILD_STATUS alone.
- Confirm no parser/compiler exceptions in output and confirm APK exists at:
- C:\b4a\workspace\SithasoDaisyUIKit\B4A\Objects\SithasoDaisyUIKit.apk
4) B4XDaisyDiv styling/events
- B4XDaisyDiv now supports:
- Click event: EventName_Click(Tag As Object)
- BorderStyle: none|hidden|solid|double|dashed|dotted|groove|ridge|inset|outset
- BorderReliefStrength (0..100)
- AutoReliefByStyle (True/False)
5) B4X custom class member syntax nuance
- Even when `B4XDashboard` defines `setWidth/getWidth`, using `Dashboard.Width = "100%"` may fail with:
- "Unknown member: width"
- Use explicit setter methods instead:
- `Dashboard.setWidth("100%")`
- `Dashboard.setHeight("100%")`
6) Android video capture helper
- Added `record.ps1` in project root.
- Modes:
- `.\record.ps1 -Action once -DurationSec 10`
- `.\record.ps1 -Action start`
- `.\record.ps1 -Action stop`
- Outputs videos to:
- `B4A\screenshots\latest-record.mp4`
- `B4A\screenshots\screenrec-yyyyMMdd-HHmmss.mp4`
- record.ps1 now supports extended once-recording by chunking 180s max segments: .\record.ps1 -Action once -DurationSec 181 -> SEGMENTS=2
7) B4X custom view baseline (from B4XCustomViewsV2_5)
- Prefer XUI CustomView template (`mBase As B4XView`, `DesignerCreateView(Base As Object, ...)`) even for mono-platform projects.
- Keep standard lifecycle signatures:
- `Initialize(Callback As Object, EventName As String)`
- `DesignerCreateView(Base As Object, Lbl As Label, Props As Map)`
- `Base_Resize(Width As Double, Height As Double)` for layout updates.
- In `DesignerCreateView`, preserve Tag pattern:
- `mTag = mBase.Tag`
- `mBase.Tag = Me`
- expose `setTag/getTag` for external Tag access.
- Use `#DesignerProperty` + defaults (safe access via `Props.GetDefault` equivalent helpers) to avoid old-layout breakage.
- Expose public properties with `setX/getX` naming.
- Raise external events with `xui.SubExists(...)` + `CallSub2/CallSub3`.
- Provide `AddToParent` / `AddToParentAt` for code-based creation.
8) XUI baseline (from B4XXUIV2_5)
- Prefer `B4XView` as the common wrapper in component internals, and switch to native objects only where platform-specific APIs are needed.
- Use `dip` for geometry and spacing across platforms; do not use `dip` for font sizes (`xui.CreateDefaultFont(Size)` expects plain size values).
- Normalize mixed color objects with `xui.PaintOrColorToColor(...)` when values may come from designer/native paint types (especially for B4J compatibility).
- For cross-platform callback checks, use `xui.SubExists(mCallBack, mEventName & "_EventName", NumberOfArguments)` with matching `CallSub...` calls.
- Remember `B4XCanvas` updates require `Invalidate`, and call `Release` where relevant for lifecycle hygiene.
- Keep in mind slight stroke rendering differences between B4J and B4A/B4i when using `DrawPath` and thick outlines.
- `xui.CreatePanel(...)` creates a clipping container; in B4A it must be created from an Activity context.
- Use XUI-compatible controls/patterns when native views differ across platforms (for example: `xCustomListView`, `B4XSwitch`, `B4XComboBox`, `B4XSeekBar`).
9) Graphics baseline (from B4XGraphicsV2_5)
- Prefer XUI graphics (`B4XCanvas`, `B4XPath`, `B4XRect`, `B4XBitmap`) for shared component code.
- `B4XCanvas` draws on `B4XView` panel/pane containers (not ImageViews). Keep a dedicated draw panel when needed.
- After drawing with `B4XCanvas`, call `cvs.Invalidate` to commit changes.
- If a host view is resized, release/recreate drawing resources as needed (`Canvas.Release` + reinitialize pattern).
- Use `dip` for coordinates and sizes in drawing code for B4A consistency.
- Be aware of transparency differences: B4J transparent draw behavior differs; `ClearRect` is the reliable way to clear areas.
- Use `MeasureText` for precise text centering/baseline math instead of hardcoded offsets.
- For heavy pixel operations, use `BitmapCreator` (BC) and keep units in pixels (no dip units in BC workflows).
- BC performance tips: skip blending when possible, prefer async draw tasks for complex composites.
- BC path types differ from `B4XPath` (`BCPath` is separate); do not mix path object types.
10) B4XPages baseline (from B4XPagesCrossPlatformProjectsV2_5)
- B4XPages classes are regular classes: pages are not paused/destroyed independently; state is kept until process kill.
- Put one-time UI setup in `B4XPage_Created`; use `B4XPage_Appear/Disappear` for visibility-driven refresh/sync.
- Handle app lifecycle in `B4XPage_Background` / `B4XPage_Foreground` (save volatile state in Background).
- Use `B4XPages.AddPage("Id", PageInstance)` once, and navigate with `B4XPages.ShowPage("Id")`.
- Access other pages directly with typed references from `B4XPages.GetPage("Id")`; avoid unnecessary `CallSubDelayed`.
- For close/back handling use `B4XPage_CloseRequest` (B4A/B4J) and return True/False explicitly.
- Keep `Main` template code unchanged in B4XPages projects; place shared logic in page classes instead.
- Use relative links for shared modules and parent-folder structure so edits propagate across B4A/B4i/B4J projects.
- In B4A, note the documented orientation constraint for the single host activity (lock orientation if required by app flow).
- Navigation-stack debugging tip: verify expected stack behavior per platform when combining `ShowPage` + `ClosePage` (B4i stack behavior differs in some flows).