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: TModalDialogProc);
var
zIndex: integer;
begin
panel.MoveTo((CurrentForm.ClientWidth - panel.Width) div 2,
(CurrentForm.ClientHeight - 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) then
(focusControl as TW3CustomControl).SetFocus;
panel.MoveTo((CurrentForm.ClientWidth - panel.Width) div 2,
(CurrentForm.ClientHeight - panel.Height) div 2);end;
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;
begin
FSelectedItem := nil;
FHighlightedItem := nil;
for var i := 0 to FItems.Count - 1 do FItems[i].Free;
FItems.Clear;
UpdateScrollBar;
end;
You would, of course, also have to add “procedure Clear;” to the public section of the TW3ListBox class.
No comments:
Post a comment