[SOLVED] Combobox dropdown reduces to 1 in pagecontrol lazarus / 31-LCL ---------------------------------------------------------------------- BigChimp · 2014-01-18 15:26 See attached project. I copied over a working combobox from a regular form, which drops down to 8 entries when you select it, showing enough context to comfortably navigate around. However, in the current project, it shows only 1 dropdown, which makes for awkward manoeuvering. Is this me doing something stupid or a bug in the LCL? (I'm guessing the former ) Laz 1.2.RC2, FPC 2.6.2 x86, Win 7 x64. ---------------------------------------------------------------------- taazz · 2014-01-18 16:01 tested with lcl1.1 (didn't update for a long time) it is an lcl bug. If you change your code from Code: [Select]...     ProfileSelect.Items.Clear;     ProfileSelect.Items.AddStrings(Sections); to Code: [Select]...     ProfileSelect.Items.Assign(Sections); Everything seems to work as expected, you get the correct behavior if you addCode: [Select]    ProfileSelect.DropDownCount:=10; after the two lines of code shown above as well. Something is going extremely wrong with the addstrings I guess. ---------------------------------------------------------------------- engkin · 2014-01-18 16:12 Same is here. It works ok if Items.count>0: Code: [Select]    ProfileSelect.Clear;     ProfileSelect.Items.Add('Test');//<---     ProfileSelect.Items.AddStrings(Sections); Edit: At some point the internal value of FItems is replaced with a TWin32ComboBoxStringList = class(TWin32ListStringList) instance, which does not override AddStrings and misses calling UpdateComboHeight. ---------------------------------------------------------------------- Bart · 2014-01-18 17:22 I cannot reproduce this. TSCombo is on a TTabSheet in a TPageControl. Code: [Select]  TSCombo.Clear;   TSCombo.Items.AddStrings(Memo1.Lines); It dropws down with the same amount (5, despite DropDownCount = 8, but this is WS related I think). Lazarus 1.3 r43552 FPC 2.6.4RC1 i386-win32 on Win7-64 Bart ---------------------------------------------------------------------- BigChimp · 2014-01-19 11:25 Thanks a lot guys, I'll have a look at the behaviour/code in trunk following engkin's tips. ---------------------------------------------------------------------- BigChimp · 2014-01-19 12:15 See the same behaviour in Laz trunk. Submitted bug report http://bugs.freepascal.org/view.php?id=25556 with big thanks to you guys, especially engkin @Bart: strange that you cannot reproduce. Can you reproduce using the demo program I've added to the bug report? ---------------------------------------------------------------------- Bart · 2014-01-19 13:41 Yes I can reproduce with you example (after I removed some unit in uses clause becuase it refused to compile). How do I apply your patch? I tried Code: [Select]C:\devel\lazarus>patch --verbose  < combodropdownwin32.diff Hmm...  Looks like a unified diff to me... can't find file to patch at input line 5 Perhaps you should have used the -p or --strip option? The text leading up to this was: -------------------------- |Index: lcl/interfaces/win32/win32listsl.inc |=================================================================== |--- lcl/interfaces/win32/win32listsl.inc       (revision 43770) |+++ lcl/interfaces/win32/win32listsl.inc       (working copy) -------------------------- File to patch: Skip this patch? [y] Skipping patch. Hunk #1 ignored at 420. 1 out of 1 hunk ignored Hmm...  The next patch looks like a unified diff to me... can't find file to patch at input line 24 Perhaps you should have used the -p or --strip option? The text leading up to this was: -------------------------- |Index: lcl/interfaces/win32/win32listslh.inc |=================================================================== |--- lcl/interfaces/win32/win32listslh.inc      (revision 43770) |+++ lcl/interfaces/win32/win32listslh.inc      (working copy) -------------------------- File to patch: Skip this patch? [y] Skipping patch. Hunk #1 ignored at 84. 1 out of 1 hunk ignored done Obviously I have the same folder layout given that I run patch from ($Lazarus) folder. This patch program is driving me nuts. Bart ---------------------------------------------------------------------- Bart · 2014-01-19 14:03 I apllied your patch with slight modification (patched it by hand). Someone needs to see if this is needed in WinCE as well. Bart ---------------------------------------------------------------------- BigChimp · 2014-01-19 14:14 Thanks a lot, Bart! Quote from: Bart on January 19, 2014, 02:41:51 pmHow do I apply your patch? By using a normal patch program like the one git supplies or perhaps subversion... or anything on linux. ... or fiddling till you get blue in the face with -p x parameters... I tried to write a tool that automates this on Windows: https://bitbucket.org/reiniero/patchwrangler Maybe it's time to look and see if there's a less braindead version of patch.exe available for windows to be supplied with FPC/Lazarus... Quote from: Bart on January 19, 2014, 02:41:51 pmObviously I have the same folder layout given that I run patch from ($Lazarus) folder. This patch program is driving me nuts. Don't get me started... oh, you already did ---------------------------------------------------------------------- Bart · 2014-01-19 15:55 Funny thing is that when I did it by hand, it turned out that one of my several attempts at least did do the implementation. The definition didn't make it. This is even stranger to me. In the past I have maged to apply patches that meet these conditions: There is only 1 file involvedLineEnding must be native to my computer (in this case CrLf). So I have to convert anything that was created with "svn diff", because this produces Linux style LineEnding. Bart ---------------------------------------------------------------------- Bart · 2014-01-19 15:57 Quote from: Bart on January 19, 2014, 03:03:08 pmSomeone needs to see if this is needed in WinCE as well. I finally got a WinCE emulator up and running (let's wait and see  how long that keeps working). It seems WinCE doesn't need the patch. I also checked Linux, which is fine too. Bart ---------------------------------------------------------------------- Bart · 2014-01-19 16:09 Quote from: BigChimp on January 19, 2014, 03:14:27 pmBy using a normal patch program like the one git supplies or perhaps subversion... or anything on linux. ... or fiddling till you get blue in the face with -p x parameters... I tried to write a tool that automates this on Windows: https://bitbucket.org/reiniero/patchwrangler Hmm. Downloaded executable. Run it: Exception: Unable to open file "C:\Users\Bart\Downloads\readmedemo.diff". Press OK to ignore and risk data corruption. Press Cancel to kill the program. Not very nice. I click OK and it runs. I clear the field that says what patchfile and I set Repository root. Then I exit. And restart. Same exception. No field has been saved. Bart ---------------------------------------------------------------------- Bart · 2014-01-19 16:22 Another error I don't understand: Patch file: C:\devel\lazarus\combodropdownwin32.diff Repository root: C:\devel\lazarus Click on Dry Run: Original file ending is: DOS (CR/LF). User initiated dry run Going to run: cmd.exe "/c" "C:\devel\fpc\bin\i386-Win32\patch.exe -b -d C:\development\ --remove-empty-files --verbose --dry-run < C:\Users\Bart\AppData\Local\Temp\TMP00000.tmp" patch: **** can't change directory to `C:\development\' : No such file or directory Patch run gave result code 2 Where does this "C:\development" come from. After that I tried to copy some fields, tabbing through them. That eventually hung up the program, and I had to kill it. Bart ---------------------------------------------------------------------- BigChimp · 2014-01-19 16:27 Thanks for the report. Removed outdated binaries. Please use the source QuoteWhere does this "C:\development" come from. See the readme: it's a default/fallback (which happens to match standard fpcup setup). ---------------------------------------------------------------------- Bart · 2014-01-19 18:10 Built from sources. Still freezes here: Selected patch file as above set root to "c:\devel\lazarus" ctlRootDirectoryEditingDone(Sender: TObject) -> GetCandidates -> TPatcher.FindCandidates -> ++TestFiles: NewPath = C:\devel\lazarus\lcl\interfaces\win32\ ++TestFiles: calling RunPatch(C:\Users\Bart\AppData\Local\Temp\TMP00035.tmp) (Checked: that file exists and seems to be the correct diff file) It just hangs. Bart ---------------------------------------------------------------------- BigChimp · 2014-01-20 08:42 Thanks Bart, I suppose my tool sucks at the moment Raised a bug report. That said, in general using git apply (from msysgit) uses to work ok, though of course when I just tried it with the patch it failed as well!?!? ---------------------------------------------------------------------- Bart · 2014-01-20 17:41 We could re-invent the wheel and write our own fppatch? It's not as if we have nothing to do  Bart ---------------------------------------------------------------------- BigChimp · 2014-01-20 18:16 Sorry, first [1] I'm going to reinvent the wheel and rewrite a resource compiler http://bugs.freepascal.org/view.php?id=24482 [1] Sometime. I hope.