Recent

Author Topic: [SOLVED] Combobox dropdown reduces to 1 in pagecontrol  (Read 9026 times)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
[SOLVED] Combobox dropdown reduces to 1 in pagecontrol
« on: January 18, 2014, 04:26:13 pm »
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.
« Last Edit: January 20, 2014, 09:43:00 am by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #1 on: January 18, 2014, 05:01:27 pm »
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 add
Code: [Select]
    ProfileSelect.DropDownCount:=10;
after the two lines of code shown above as well. Something is going extremely wrong with the addstrings I guess.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #2 on: January 18, 2014, 05:12:18 pm »
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.
« Last Edit: January 18, 2014, 06:23:47 pm by engkin »

Bart

  • Hero Member
  • *****
  • Posts: 5564
    • Bart en Mariska's Webstek
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #3 on: January 18, 2014, 06:22:14 pm »
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

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #4 on: January 19, 2014, 12:25:46 pm »
Thanks a lot guys, I'll have a look at the behaviour/code in trunk following engkin's tips.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #5 on: January 19, 2014, 01:15:08 pm »
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?
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Bart

  • Hero Member
  • *****
  • Posts: 5564
    • Bart en Mariska's Webstek
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #6 on: January 19, 2014, 02:41:51 pm »
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

  • Hero Member
  • *****
  • Posts: 5564
    • Bart en Mariska's Webstek
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #7 on: January 19, 2014, 03:03:08 pm »
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

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #8 on: January 19, 2014, 03:14:27 pm »
Thanks a lot, Bart!

How 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...

Obviously 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 ;)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Bart

  • Hero Member
  • *****
  • Posts: 5564
    • Bart en Mariska's Webstek
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #9 on: January 19, 2014, 04:55:07 pm »
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 involved
  • LineEnding 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

  • Hero Member
  • *****
  • Posts: 5564
    • Bart en Mariska's Webstek
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #10 on: January 19, 2014, 04:57:06 pm »
Someone 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

  • Hero Member
  • *****
  • Posts: 5564
    • Bart en Mariska's Webstek
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #11 on: January 19, 2014, 05:09:58 pm »
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

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

  • Hero Member
  • *****
  • Posts: 5564
    • Bart en Mariska's Webstek
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #12 on: January 19, 2014, 05:22:04 pm »
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

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #13 on: January 19, 2014, 05:27:48 pm »
Thanks for the report. Removed outdated binaries. Please use the source

Quote
Where does this "C:\development" come from.
See the readme: it's a default/fallback (which happens to match standard fpcup setup).
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Bart

  • Hero Member
  • *****
  • Posts: 5564
    • Bart en Mariska's Webstek
Re: Combobox dropdown reduces to 1 in pagecontrol
« Reply #14 on: January 19, 2014, 07:10:25 pm »
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
« Last Edit: January 19, 2014, 07:13:40 pm by Bart »

 

TinyPortal © 2005-2018