How to Use TMS IntraWeb iPhone Controls Pack in Your Web Apps
This guide shows a practical workflow to add TMS IntraWeb iPhone Controls to an IntraWeb web application, style it for mobile, and handle common interactions. Assumptions: you have Delphi with IntraWeb and the TMS IntraWeb iPhone Controls Pack installed; an existing IntraWeb project (or create a new one).
1. Add controls to your project
- Open your IntraWeb project in Delphi.
- On the form (IWForm or IWFrame) place TMS iPhone controls from the component palette (e.g., TIWtiPhoneToolbar, TIWtiPhoneButton, TIWtiPhoneListView, TIWtiPhoneSwitch).
- Arrange controls visually for the intended mobile layout: header/toolbars at top, list or content in the middle, fixed footer/action bar if needed.
2. Configure control properties for mobile behavior
- Size & Anchors: Set Width to 100% where available or anchor Left/Right to stretch. Use Anchors/Align to keep toolbar pinned.
- CSS class: Use the control’s Style or CustomCSS property to add concise classes for responsive tweaks.
- Icons & Images: Use small PNG/SVG assets for buttons; set the control’s ImageIndex/Image properties.
- List performance: For long lists use virtualization options (if provided) or load items on demand (see step 5).
3. Wire up events and server callbacks
- Use OnClick, OnChange, OnSelect events on controls for user actions.
- For fast UX, prefer asynchronous updates: call IntraWeb’s AJAX partial postbacks (e.g., UpdateRegion/RefreshControl) so only portions of the page are refreshed.
- Example pattern:
- Button click triggers server event.
- Server updates a data source or list items.
- Call RefreshControl or set a control’s .Invalidate to update the UI without a full reload.
4. Navigation and views
- Use IWFrame or multiple IWForms to represent different app screens (e.g., Home, Details, Settings).
- Implement a toolbar/back button that performs a frame swap:
- Hide current frame, show target frame, optionally update URL fragment for bookmarking.
- Keep transitions smooth by toggling visibility and using light CSS animations on the content container.
5. Handling data lists and detail pages
- Populate TIWtiPhoneListView (or similar) from a dataset or array. Use a data-binding loop:
- Clear existing items.
- For each record create a list item with title, subtitle, and an identifier in Tag or CustomData.
- On item click, read the identifier and load the detail frame asynchronously.
- For large datasets, implement paging or incremental load (Load More button or infinite scroll using client-side JS to trigger server callbacks).
6. Forms, inputs, and validation
- Use TMS iPhone input controls for native-looking inputs (text, switches, sliders).
- Validate on the server in control events; mirror critical checks on client-side JS for immediate feedback.
- After successful submission, show a toast/alert control or navigate back to the previous screen with updated data.
7. Styling and responsive tweaks
- Add a small CSS file for breakpoints and control overrides. Example adjustments:
- Increase tappable areas: padding for buttons and list items.
- Font sizes: 16px+ for body text for mobile readability.
- Hide nonessential desktop UI elements at narrow widths.
- Use control-specific CSS classes provided by the pack to keep overrides minimal.
8. Performance and testing
- Minimize server round-trips by batching updates where possible.
- Compress and optimize images.
- Test on real iOS devices and in Safari mobile emulator; verify touch targets, scrolling, and orientation changes.
9. Common issues and fixes
- Controls not stretching: ensure Align/Width and parent container settings allow fluid layouts.
- Slow updates: switch from full form postbacks to partial updates/RefreshControl.
- Event not firing on touch: ensure control is enabled and not overlapped by another element; consider z-index and pointer events in CSS.
10. Example minimal code snippets
- Populate a list (pseudocode):
pascal
ListView.Items.Clear; for i := 0 to High(Data) do with ListView.Items.Add do begin Text := Data[i].Title; SubText := Data[i].Subtitle; Tag := Data[i].ID; end; ListView.Refresh;
- Button click to show detail:
pascal
procedure TMainForm.ListViewItemClick(Sender: TObject; Item: TListItem); begin LoadDetailFrame(Item.Tag); DetailFrame.Visible := True; MainFrame.Visible := False; end;
Conclusion
Use the TMS IntraWeb iPhone Controls Pack by placing its components on IW forms/frames, configuring layout/anchors and CSS for responsive behavior, wiring events for server-side logic with AJAX partial updates, and optimizing lists and navigation for mobile UX. Test on devices, favor partial refreshes for responsiveness, and keep touch targets and fonts mobile-friendly.
If you want, I can produce a ready-to-copy example project structure (unit files and sample forms) tailored to your Delphi/IntraWeb version.
Leave a Reply