customcontrol drawing lazarus / 43-Android ---------------------------------------------------------------------- zariq · 2013-08-01 23:49 hi everyone. I've been trying out the androidlcltest on an emulator and a phone which is 720 X 1280. I would like to ask about some issues. The subcontrol in the example draws itself 3 times larger than it's supposed to, e.g setting width to 220 and height to 370 fills the 720 by 1280 display. it recieves touch events based on how it has been drawn and not how it should have been drawn, which is fine, but because of the difference, any scrolling implementation will be off. I hope it makes sense. thanks. ---------------------------------------------------------------------- felipemdc · 2013-08-03 16:00 In Lazarus in Linux, Windows, Mac OS X, we are used to having positions and sizes of controls in the value of pixels. But in Android, this would be hell, because there are hundreds of devices with different screen sizes, resolutions, etc. So the LCL for Android will resize and reposition controls to make them better fit the available screen. I think that there is an option to turn it off, thought can't remember exactly ... ---------------------------------------------------------------------- zariq · 2013-08-03 17:29 Thanks Felipe for your reply. I found out about the resizing when I set the heightof a button from code to the same value as in the designer and it shrunk to less than half the height. I was trying to show some text that would scroll horizontally and vertically. Since memo isn't scrolling I thought I'd see how the subcontrol was working in the example. I was storing the dimensions in the constructor, and because of the resizing, obviously the scrolling wasn't working properly. Just tried resetting the width, height, left and top from a buttonclick and everything gets set properly. Even the scrolling which I put together using textextent seems to be work in the emulator. It only works after the constructor has completed, perhaps onshow should the place. On another matter, if you don't mind me asking, are you still working actively on the interface and if you are, what are your plans for tmemo. thanks. ---------------------------------------------------------------------- felipemdc · 2013-08-04 13:38 Quote from: zariq on August 03, 2013, 07:29:34 pmOn another matter, if you don't mind me asking, are you still working actively on the interface and if you are, what are your plans for tmemo. Ummm ... I was actually hoping that it would attract someone to take over most of the work, like the Qt and WinCE interfaces that I started attracted many contributors. I'm really out of free time to improve TMemo at the moment ... it's really hard to say when I will come back to this task ... my ToDo is enormous and growing fast =D fpvectorial is my focus at the moment. ---------------------------------------------------------------------- zariq · 2013-08-04 22:23 Where and when is the resizing taking place? After creating the control in the oncreation of a form, the only way to show the actual position and size  is to change the numbers again in a buttonclick, or with a timer, although haven't tested it with the timer.Onshow of the form is either too early or it's a case similar to those situations where the screen needs tapping before some changes get reflcted on screen like listviewdialog. Is it possible to use native edit control? It's a shame you haven't got the time to improve tmemo because it leaves a big hole. Maybe putting some notes somewhere about the interface might encourage someone (the files and units involed, their location and the type of code/controls). thanks. ---------------------------------------------------------------------- felipemdc · 2013-08-05 11:30 Quote from: zariq on August 05, 2013, 12:23:56 amWhere and when is the resizing taking place? The auto-adjustment is done here: lazarus/lcl/interfaces/customdrawn/customdrawnwsforms_android.inc class procedure TCDWSCustomForm.ShowHide(const AWinControl: TWinControl); There is this property which you can set in your code to disable the auto-adjustment: Application.LayoutAdjustmentPolicy := lapFixedLayout But I'm not 100% sure that LCL-CustomDrawn-Android respects it. If it doesn't, it should be trivial to make it respect it, however. QuoteIs it possible to use native edit control? No, unfortunately the way the native UI was created by Google makes it unsuitable for mixing it with our own. There are lots of nasty stuff which Google made in their UI ... it uses a different layer than native apps have access too, to start with. Also we cannot create sub- windows in their UI system, they have only 4 layers, so the Android API does not support true sub-windows. I don't know what kind of nasty stuff they did in their own code to get something which works like sub-windows, but for native controls it is a hell to try to co-exist with the native Android controls ... so I simply gave up. Native controls in my design can be seen only in dialogs, like the dialog which pops up for the combobox. QuoteIt's a shame you haven't got the time to improve tmemo because it leaves a big hole. Maybe putting some notes somewhere about the interface might encourage someone (the files and units involed, their location and the type of code/controls). The memo is implemented in a generic LCL code in lazarus/lcl/customdrawncontrols.pas control TCDEdit From what I remember TCDEdit implements both memo and TEdit