April 10, 2013

New in Smart 1.1: Bugs and Omissions

The 1.1 edition generally works very well but there are still few glitches. At the moment I am aware of two problems which can both be fixed by editing the RTL code.

Modal Dialogs are not Centred

Modal dialogs (I’ll write about them shortly; for now you can check the ModalDialog demo) were supposed to be displayed centred on the screen – and they were, until shortly before the release a change in the RTL broke the position calculation. Everybody failed to notice that and modal dialogs were released in a less than functional state.

Luckily, the fix is simple. Open the C:\ProgramData\Optimale Systemer AS\Smart Mobile Studio\RTL\W3Application.pas in a Notepad utility. If you are using any new Windows OS, you’ll have to start it with elevated privileges as this path is protected by the operating system. Simply press Ctrl+Esc, type Notepad and press Ctrl+Shift+Enter. You should also make sure that the Smart Mobile Studio is not running.

Locate the following code:

procedure TW3CustomApplication.ShowModal(form: TW3CustomForm; 
panel, focusControl: TW3CustomControl;

onInit, onOK, onCancel:
panel.MoveTo((CurrentForm.ClientWidth - panel.Width) div 2
- panel.Height) div 2
); if FModalInfoList.Count = 0 then

Cut the MoveTo call and move it to the end of the same method:

  modalInfo.ModalPanel.Handle.style.zIndex := IntToStr(zIndex + 2);

if Assigned(focusControl)
(focusControl as

- panel.Width) div 2,
(CurrentForm.ClientHeight - panel.Height) div 2

This will fix the problem.

Listbox Cannot Be Cleared

The TW3ListBox control in 1.1 is missing a method to clear its contents. Add the following code to the W3ListBox.pas unit to fix the problem.

procedure TW3ListBox.Clear;
FSelectedItem := nil
FHighlightedItem := nil
for var i := 0 to FItems.Count - 1 do

You would, of course, also have to add “procedure Clear;” to the public section of the TW3ListBox class.

No comments:

Post a comment