Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Design question for an app to be used on a smartphone
Thu, Jul 24 2014 10:58 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Hi

I am new to EWB and am using it in unfamiliar environments i.e. my new Samsung Galaxy S5 phone and my QA guy's iPhone 5.  Plus modules of the app might be used on tablets or Desktop PC's - anything really.

My current struggle is something that works perfectly in the IDE but is useless on my phone.  The module is used to find contacts that reside in an EDB database.

I use a unbound TEdit to enter part of a contacts details (part of a phone number, name, ) As the details are entered this code is executed:-

procedure TfrmMain.edtSearchChange(Sender: TObject);
begin
 with edtSearch do
 begin
   if (Text = Hint) or (Text = '') then
   begin
     Text := Hint;
     SetFocus;
     SelectAll;
   end;
   LoadContacts; //SQL to populate grid based on 'LIKE % +'edtSearch.Text
 end;
end;

... both Hint and Text contain 'Enter Name or Phone'

LoadContacts populates a grid using: MyField LIKE '%' +'edtSearch.Text + '%' : on a number of fields.

This works well and fast on a typical user database that has 1500 contacts when running in the IDE or from a desktop browser over very  low speed internet connections.

The problem is the TEdit code on the smartphone.  

When I tap on the TEdit it pops up the virtual keyboard and I can enter part of the name

But it doesn't give me the chance to react to each character entered as it does with a real keyboard and even it it did then the  keyboard would be obscuring the grid so I wouldn't be able to pick off the contact.  (I use a click/tap on the grid row to display the contact details.)

----------------------------
A problem lies in the use of a TComboBox - it maybe my skills with a smartphone (well they definitely aren't great - not just the fat fingers), but I don't see how to do it.

The combobox has 4 entries ALL,Landlords,Tenants,Suppliers and is preloaded with 'ALL' in the form create

 cboGroups.Text := 'ALL';

But the dropdown only contains the 'ALL'  and apparently blank lines - just tried it with Text := ''; and get the same result.

I've tried tinkering with the ReadOnly and AllowEdit properties, but am getting nowhere.

I have this OnChange procedure

procedure TfrmMain.cboGroupsChange(Sender: TObject);
begin
 if cboGroups.Text = 'ALL' then gsSearchType := 'X'
 else gsSearchType := Copy(cboGroups.Text,1,1);
 LoadContacts;
end;
.. but don't see how that can matter - nothing is done to the combobox, just the Text used.
-------------------------

Having a few problems with getting my head around the new environment.

Cheers

Jeff


Fri, Jul 25 2014 4:28 AMPermanent Link

Matthew Jones

Jeff Cook wrote:

> But it doesn't give me the chance to react to each character entered
> as it does with a real keyboard and even it it did then the  keyboard
> would be obscuring the grid so I wouldn't be able to pick off the
> contact.  (I use a click/tap on the grid row to display the contact
> details.)

I was going to say it works for me, and then I remembered Android...
Google think you don't deserve to have the change events, so you have
to program specially for it. I added this to my FormCreate event:

   if Pos('Android', window.navigator.useragent) > 0 then
       keyCheckTimer.Enabled := True;

This then just checks to see if the text has changed, and if so takes
appropriate action. If you search back you will see I posted the link
to web discussion of Google's decision on this. The iPhone will work
fine with the OnChange event.

I've not had problems with the combobox - but you might want to
consider a scrollable panel with items on it instead. Depends on your
requirements really. You should be seeing all the items anyway.

--

Matthew Jones
Fri, Jul 25 2014 5:13 AMPermanent Link

Walter Matte

Tactical Business Corporation


Others have comment on the ComboBox  behaviour and use Grids instead... do a search... here is on line

http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&page=1&msg=5009#5009

Walter
Fri, Jul 25 2014 6:54 AMPermanent Link

Uli Becker

Jeff,

> But the dropdown only contains the 'ALL'  and apparently blank lines - just tried it with Text := ''; and get the same result.

Don't use a combobox if you want to run your site under Android.

Have a look at the attached screenshot from an EWB app on an Android
tablet. The "combobox" is a panel with an image (arrow) and a TGrid
which is placed accordingly.

For Android I usually write a tiny app with Android Studio just
containing one activity with a webview.

By adding this line

< android:windowSoftInputMode="adjustPan" >

to the manifest I can control the keyboard so that the web content
doesn't switch out of view when the soft keyboard is opened.
In addition I have no navigation bar nor a title bar which takes away space.

Uli





Attachments: Clip13.png
Sun, Jul 27 2014 7:32 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Thanks Matthew, Walter and Uli

Loads of advice in this thread for me.

I now know how to tell if I'm on an Android, I know how to handle changes in and edit without using the OnChange event and warned off using comboxes.

Now I just find about about this manifest thing and how to construct combos out of edits and grids.  Though thinking about it, since I have limited number of choices in my combo, perhaps radio buttons or check boxes would be a better choice in this case

Thanks to you all - as you can probably guess, I am fairly weak on HTML and no practical knowledge of javascript at all.  I was hoping the EWB would insulate me form those two things, but I guess I'm going to have to learn a lot more than anticipated.  Frown

Cheers

Jeff
Sun, Jul 27 2014 7:46 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

I was also going to add that it would be nice know a bit more about what EWB 2 is likely to bring.

Perhaps some of the things (like the combobox problem will feature in that.  I've looked at the Road Map and it isn't mentioned, but Tim's postings imply that there will be more in it than "just" the listed items.

Also I was just about to launch into "Themes" but Tim recent post said "And yes, the themes are gone in EWB 2." (and that wasn't in the Road Map)

And yes, I know Tim won't speculate on dates if I ask.  Something I have relearnt for Tim is to say "it will be ready when it is ready".  I have recently fallen into the habit of promising dates which is BAD, BAD, BAD Wink

Cheers

Jeff
Mon, Jul 28 2014 4:22 AMPermanent Link

Matthew Jones

Jeff Cook wrote:

> Thanks to you all - as you can probably guess, I am fairly weak on
> HTML and no practical knowledge of javascript at all.  I was hoping
> the EWB would insulate me form those two things, but I guess I'm
> going to have to learn a lot more than anticipated.  Frown

I think it does a good job of that, but when you face a problem, simply
google it in HTML terms. Between that and the framework source, you
will find what you need.

--

Matthew Jones
Mon, Jul 28 2014 4:25 AMPermanent Link

Matthew Jones

Jeff Cook wrote:

> I was also going to add that it would be nice know a bit more about
> what EWB 2 is likely to bring.

I think that better attention to mobile was on the roadmap, but when is
an interesting question. Things like touch events would be nice to
have. But combo boxes are just a practical thing. You can have them,
but do they work well on mobile? The answer is yes for some situations,
and no for others. Only you can tell. iOS for example supports them
just fine, but they appear in a different form to that on the desktop.
If that alternative doesn't fit your need, it is "easy" to use TPanel
and a bit of programming to make your own. (I wish I had spare time to
complete my demo application...)

--

Matthew Jones
Image