pbColors dialog discussion...
#1
Eventual discussion about source  "pbColors dialo" here. See https://pump.richheimer.de/showthread.php?tid=165
Reply
#2
Hey! Hey! Borje!

just reading through your code, I noticed a small typo...
Code:
'------------------------------------------------------------------
  ' Page 4 LB is special - we use multicolumn feature for gridlike looks
  CONTROL ADD LISTBOX, hTab4, %IDC_LISTBOX1,, 1, 1, 179, 127, dwStyle OR _
                      %LBS_MULTICOLUMN, %WS_EX_CLIENTEDGE

  'CONTROL HANDLE hTab2, %IDC_LISTBOX1 TO ghListBox4  '<-wrong tab page
  CONTROL HANDLE hTab4, %IDC_LISTBOX1 TO ghListBox4 

The ownerDraw listbox, for the first 3 tabs it shows white space scrolling to the very bottom. No big deal, I simply added one line after each control add listbox... 
Code:
  CONTROL ADD LISTBOX, hTab1, %IDC_LISTBOX1, , 1, 1, 179, 147, dwStyle, %WS_EX_CLIENTEDGE
  CONTROL SET COLOR hTab1, %IDC_LISTBOX1, -1, GetSysColor(%COLOR_INFOBK) '<-JM added, blends in with the items instead of white.  

Thanks again for posting this!  I just retired my old version for yours.  Wink


I get it now, ...why you let the bottom of the first 3 listbox's alone!  I resized the first 3 listbox's to snug fit the items now shows the tab control area instead, then on tab 4 you needed that area.  Ok, my bad.  I like the above matching color  solution instead. 

          

Code:
'-JM added---------------------------------------------------------------
SUB FitListBox(BYVAL hLB AS DWORD)
  LOCAL rcC, rcW AS RECT
  LOCAL itemH, rows, ncH AS LONG
  itemH = SendMessage(hLB, %LB_GETITEMHEIGHT, 0, 0)
  IF itemH < 1 THEN EXIT SUB
  GetClientRect hLB, rcC
  GetWindowRect hLB, rcW
  ncH  = (rcW.nBottom - rcW.nTop) - rcC.nBottom  ' border height
  rows = rcC.nBottom \ itemH                      ' whole rows that fit
  SetWindowPos hLB, 0, 0, 0, rcW.nRight - rcW.nLeft, rows * itemH + ncH, %SWP_NOMOVE OR %SWP_NOZORDER
END SUB   
'-  call after each  "CONTROL SEND hTab1, %IDC_LISTBOX1, %LB_SETITEMHEIGHT, 0, c * 2" 
Reply
#3
God catch, Jules - thanks! I see why it works with wrong handle, because it's only used to getting and setting line height and all listboxes has same from start. I'll apply you findings to the code - I see now that I need to test it with other screen scaling, because while it looks god with scaling set to 150%, if differs a lot with 100% = no scaling set. I change resizing code against listbox client size so it looks the same in any screen scaling. Think it should be ok now. Again, thanks a lot for testing and reporting, Jules! Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)