LAMW: jListView - HighLightSelectedItemColor lazarus / 43-Android ---------------------------------------------------------------------- c4p · 2017-05-21 11:07 I am currently using jListView to good effect (works well), however, the HighLightSelectedItemColor method does not seem to work? using LAMW v0.7.15 (can't see any changes that would affect this in the later release changelog to correct this). I have tried applying this to the OnClickItem event and others including via a button and oncreate form (Including setting jListView1.HighlightSelectedItem := true). Maybe I am doing something wrong? I should also mention that OnLongClickItem also does not seem to function (I will probably use this later for adding scheduled notifications). I have built a fully functional app using LAMW and very pleased with the results, just need to add some bells and whistles. Many thanks in advance. ---------------------------------------------------------------------- jmpessoa · 2017-05-21 18:23 Hello c4p! I will try fix "HighLightSelectedItemColor"! Thank you! PS. but, please, updade your LAMW from github! ---------------------------------------------------------------------- jmpessoa · 2017-05-21 20:28 Try [a rapid fixed] to jListView "highLightSelectedItem" ! Please, updated from github ....  [the longClicked was fixed some time ago...] Use: in design time set HighLightSelectedItem property to some color <> default NOTE: 1)handle form OnCreate event to initialize  just "core"  Pascal stuff.  ex: TStringList and more... 2)handle form "OnJNIPrompt" to  initialize android "jComponents" and other Android system stuff.. Thank you! ---------------------------------------------------------------------- c4p · 2017-05-22 10:00 Excellent, I will update my install from github, many thanks! ---------------------------------------------------------------------- c4p · 2017-05-23 18:07 With the updated packages I can open and create a new project and compiles/runs fine but existing project crashes on startup on the phone. Would I have to remove all existing components and reapply the new ones? works fine with existing packages.  Using latest svn. ---------------------------------------------------------------------- jmpessoa · 2017-05-23 19:59 Quote..Would I have to remove all existing components and reapply the new ones? No! Please, try menu  "Clean up and Build" ....... then "[lamw] Build Android Apk and Run" ---------------------------------------------------------------------- c4p · 2017-05-23 21:35 Sorry, yes, tried that too, keep getting control error after clean/build. I must be doing something wrong. ---------------------------------------------------------------------- jmpessoa · 2017-05-24 04:58 Well, after updated from github you need re-install all LAMW packages. Have you done that? NOTE: instalation order:       tfpandroidbridge_pack.lpk   [..../android_bridges]       lazandroidwizardpack.lpk   [..../android_wizard]       amw_ide_tools.lpk      [..../ide_tools] ---------------------------------------------------------------------- c4p · 2017-05-24 05:58 Yes, all reinstalled in that order, going to do a fresh install this evening after work, I will let you know, thanks. ---------------------------------------------------------------------- c4p · 2017-05-29 09:46 Reinstall of Laz4Android solved the issue, however, I have a few issues with some components using svn (0.7 rev. 18 - 20 May 2017): - HighlightSelectedItem does not work on jListView (tried OnJNIPrompt and others but has no effect) - even when set true and color set - jListView item row spacing seems much larger and can't find a method to reduce this? - lpWrapContent Text wrapping seems to be permanent on the jSpinner component, which is a pain, would prefer to truncate text in the box as messes up design layout. Setting to lpUseWeight results in a x/y anomaly. LongClick works perfect on jListView - this will be very useful for me, thank you. jmpessoa, I really appreciate your work on this. ---------------------------------------------------------------------- jmpessoa · 2017-05-29 17:08 Hi c4p! I just updated jListView! [try in design time set HighlightSelectedItemColor <> colbrDefault] So, please update it! I will try fix yours issues! Thank you! ---------------------------------------------------------------------- c4p · 2017-05-29 19:30 Ah! It works, but I had to remove the old jListView component from the form and add a new one on, it must had artefacts from the old component? HighLightSelectedItem works perfect now!  Thank you! ---------------------------------------------------------------------- jmpessoa · 2017-05-29 19:51 Hi  c4p, If you put the new stuff in LAMW folders, all files in your project will be updated after a re-build. ---------------------------------------------------------------------- c4p · 2017-05-29 20:16 Yes, I reorganised my folders on reinstall, should be ok now, thanks. ---------------------------------------------------------------------- c4p · 2017-05-29 22:43 I think the issue with jListView item highlight is if you set the font color to anything other than colbrDefault it will not set the color by HighLightSelectedItemColor. Just discovered this by accident when I added the new jListView component and set the font color to white and then the highlight stopped working. Sorry for giving you more work. ---------------------------------------------------------------------- jmpessoa · 2017-05-29 23:12 Well, the bug need be fixed! Thank you! ---------------------------------------------------------------------- jmpessoa · 2017-05-30 03:29 Fixed! just set property "HighLightSelectedItemColor" <> "colbrDefault" warning: the old  property "HighLightSelectedItem: boolean" was droped! Thank You! ---------------------------------------------------------------------- c4p · 2017-05-31 09:28 Awesome, thank you, I will update it later. ---------------------------------------------------------------------- c4p · 2017-06-04 16:33 Sorry for the delay, it works and highlights the item using the background color, before it would only change the item font color. I did notice something though, on occasions when HighlightSelectedItemColor is selected, it sometimes stops the OnClickItem from functioning, I have noticed this more when there is one item left in the List. I have had to stop using the HighlistSelectedItemColor for now until this is resolved, sorry. ---------------------------------------------------------------------- jmpessoa · 2017-06-04 20:25 Quote... it works and highlights the item using the background color, before it would only change the item font color. Yes, item text now can be expanded in "multiples" texts!  sintaxe: leftText(center|text)rightText and set the property ItemLayout = layText NOTE: if ItemLayout <> layText  THEN in the absence of image [or widget] leftText/rightText will be used to replace its! Ok. I will try [and fix] the "one item" click bug! Thank you! [EDITED] In my test I found that one item "click" is OK, for many click . But, yes, the  "highlight" do not toggle.   Should? ---------------------------------------------------------------------- c4p · 2017-06-05 08:13 On my app when the jListView highlight color is set, sometimes (not always) the item click will not work, just restoring back to default color allows item click to work every time. Seems random, try after a reload of the list with different item length, which is what I am doing. I will do some more testing to see if it is localised. I will also try replacing the jListView component on the form which seemed to work the last time, even after doing a cleanup/build. ---------------------------------------------------------------------- jmpessoa · 2017-06-06 00:22 Well, seeing the new behavior [the highlight is now in the item background not in text caption] , my test is OK.  My picture test is attached. On the other hand, I do some jListView improved to support  the new text syntax leftPart(Center|Part)rightPart  on "OnDrawItemTextColor" event handle... There is a new demo "AppListViewDemo3"! ref.   https://github.com/jmpessoa/lazandroidmodulewizard Thank you! ---------------------------------------------------------------------- c4p · 2017-06-06 09:14 (Edit) Mine does this too, but on occasions it does to allow OnClickItem to function when HighLightSelectedItemColor is changed to anything other than cobrdefault. Specifically happens when HighLightSelectedItemColor is set to a color other than corbrDefault: Works if: - If you load the app and list all the items (without touching/selecting any items) then filter the list during runtime to say two items/rows and select an item, it will work and highlights the item OK. Does not work if: - Load up the list with your items, select an item, this part works OK - Shorten the list during runtime i.e. filtering down to say two items/rows then the OnClickItem does not work and no item highlights. ---------------------------------------------------------------------- c4p · 2017-06-06 10:43 I noticed that open and closed brackets (  ) are being stripped from jListView and replaced with spaces, but if you apply other open and closed brackets within the original open and closed brackets these secondary ones appear OK. I tried various other characters and only the open/closed brackets seemed to be stripped and replaced with spaces (nothing set in the delimiter), anything before the brackets defaults to original default font color. Hope this makes sense. ---------------------------------------------------------------------- jmpessoa · 2017-06-06 15:28 QuoteI noticed that open and closed brackets (  ) are being stripped from jListView and replaced with spaces, but if you apply other open and closed brackets within the original open and closed brackets these secondary ones appear OK. Yes, "closed brackets (  )"  are defaults but you you can change its! go to to form "OnJINIPrompt" and do: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TAndroidModule1.AndroidModule1JNIPrompt(Sender: TObject);begin   jListView1.SetLeftDelimiter('{');   //or other   jListView1.SetRightDelimiter('}'); //or otherend; ---------------------------------------------------------------------- c4p · 2017-06-06 15:58 Quote from: jmpessoa on June 06, 2017, 05:28:40 pmYes, "closed brackets (  )"  are defaults Ah yes, got it! Thank you. ---------------------------------------------------------------------- jmpessoa · 2017-06-06 16:19 Yes, and you can continue with the old syntax, too: "Item 1" or "Item 1|subItem 1" ---------------------------------------------------------------------- c4p · 2017-06-11 09:34 I have disabled the HighlightSelectedItemColor due to the anomaly I have in my app: Works if: - If you load the app and list all the items (without touching/selecting any items) then filter the list during runtime to say two items/rows and select an item, it will work and highlights the item OK. Does not work if: - Load up the list with your items, select an item, this part works OK - Shorten the list during runtime i.e. filtering down to say two items/rows then the OnClickItem does not work and no item highlights. ---------------------------------------------------------------------- jmpessoa · 2017-06-13 00:27 Quote...Shorten the list during runtime i.e. filtering down to say two items/rows then the OnClickItem does not work and no item highlights. Can you, please, post here a minimal project to test? ---------------------------------------------------------------------- c4p · 2017-06-15 06:57 I will try and do it this weekend.