[5.40x64]-ListViewGadget not scrolling all the way down

Mac OSX specific forum
WilliamL
Addict
Addict
Posts: 1224
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

[5.40x64]-ListViewGadget not scrolling all the way down

Post by WilliamL »

...I've just noticed this in my program the last beta or two and in the LTS. I've been using this code for years.

When I populate a ListViewGadget and use SetGadgetState(#Efid,CountGadgetItems(#Efid)-1) I have the gadget scrolled not all the way to the bottom of the gadget but about half way down the last item (~5 pixels up from the bottom). Some of my ListViewGadgets work fine and some don't scroll all the way down. I've tried to make an example, using the Help files, but it works fine. I can't imagine how I could cause this (not going all the way to be bottom of the window) by my code (even though it has always worked fine in the past).

I'll look at it some more and maybe somebody else has seen this behavior.
MacBook Pro-M1 (2021), Sonoma 14.4.1, PB 6.10LTS M1
User avatar
mk-soft
Always Here
Always Here
Posts: 5393
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: [5.40x64]-ListViewGadget not scrolling all the way down

Post by mk-soft »

I can not so far confirm
Perhaps the code extend so until the error occurs

Code: Select all

;-TOP

; Basis

; Konstanten

Enumeration ;Window
  #Main
EndEnumeration

Enumeration ; Menu
  #Menu
EndEnumeration

Enumeration ; MenuItems
  #MenuExit
EndEnumeration
  
Enumeration ; Gadgets
  #Splitter
  #List
  #Edit
EndEnumeration

Enumeration ; Statusbar
  #Status
EndEnumeration

; Global Variable
Global exit

; Functions
Procedure UpdateWindow()
  
  Protected x, y, dx, dy, menu, status
  
  menu = MenuHeight()
  If IsStatusBar(#Status)
    status = StatusBarHeight(#Status)
  Else
    status = 0
  EndIf
  x = 0
  y = 0
  dx = WindowWidth(#Main)
  dy = WindowHeight(#Main) - menu - status
  ResizeGadget(#Splitter, x, y, dx, dy)
  
EndProcedure

Procedure Logs(text.s)
  
  Protected temp.s, c
  
  temp.s = FormatDate("%YYYY-%MM-%DD %HH.%II.%SS - ",Date())
  temp + text
  AddGadgetItem(#List, -1, temp)
  c = CountGadgetItems(#List)
  If c > 1000
    RemoveGadgetItem(#List, 0)
    c - 1
  EndIf
  c - 1
  SetGadgetState(#List, c)
  SetGadgetState(#List, -1)
  
EndProcedure

; Main
Procedure Main()
  
  Protected event, style, dx, dy
  
  style = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget
  dx = 800
  dy = 600
  
  If OpenWindow(#Main, #PB_Ignore, #PB_Ignore, dx, dy, "Main", style)
    
    ; Menu
    ; CreateMenu(#Menu, WindowID(#Main))
    ; MenuItem(#MenuExit, "Be&enden")
    
    ; Gadgets
    ListViewGadget(#List, 0, 0, dx, dy)
    EditorGadget(#Edit, 0, 0, dx, dy)
    SplitterGadget(#Splitter, 0, 0, dx ,dy, #List, #Edit)
    SetGadgetState(#Splitter, dy * 2 / 3)
    
    ; Statusbar
    CreateStatusBar(#Status, WindowID(#Main))
    AddStatusBarField(#PB_Ignore)
    
    ; For Mac
    CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
      ; Enable Fullscreen
      Protected NewCollectionBehaviour
      NewCollectionBehaviour = CocoaMessage(0, WindowID(#Main), "collectionBehavior") | $80
      CocoaMessage(0, WindowID(#Main), "setCollectionBehavior:", NewCollectionBehaviour)
      ; Mac default menue´s
      If Not IsMenu(#Menu)
        CreateMenu(#Menu, WindowID(#Main))
      EndIf
      MenuItem(#PB_Menu_About, "")
      MenuItem(#PB_Menu_Preferences, "")
    CompilerEndIf
    
    UpdateWindow()
    
    ; Main Loop
    Repeat
      event = WaitWindowEvent(1000)
      
      Logs("Event " + Str(event))
      
      Select event
        Case #PB_Event_Menu
          Select EventMenu()
            CompilerIf #PB_Compiler_OS = #PB_OS_MacOS   
              Case #PB_Menu_About
                MessageRequester("Info", "Basis v1.0")
                
              Case #PB_Menu_Preferences
                
              Case #PB_Menu_Quit
                exit = #True
                
            CompilerEndIf
              
            Case #MenuExit
              exit = #True
              
          EndSelect
          
              
        Case #PB_Event_Gadget
          Select EventGadget()
            Case #List
              
            Case #Edit
              
          EndSelect
          
        Case #PB_Event_SizeWindow
          Select EventWindow()
            Case #Main
              UpdateWindow()
              
          EndSelect
          
        Case #PB_Event_CloseWindow
          Select EventWindow()
            Case #Main
              exit = #True
              
          EndSelect
          
      EndSelect
      
    Until exit
    
  EndIf
  
EndProcedure : Main()

End
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
WilliamL
Addict
Addict
Posts: 1224
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: [5.40x64]-ListViewGadget not scrolling all the way down

Post by WilliamL »

Thanks for looking into it mk-soft.

[edited] see below
Last edited by WilliamL on Sun Oct 18, 2015 7:39 pm, edited 1 time in total.
MacBook Pro-M1 (2021), Sonoma 14.4.1, PB 6.10LTS M1
WilliamL
Addict
Addict
Posts: 1224
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: [5.40x64]-ListViewGadget not scrolling all the way down

Post by WilliamL »

ok, final post

I'm getting a #PB_Event_SizeWindow event and, for some reason, it is resizing the gadget differently than it used to. I'll looked into it and think I've got it solved. It appears to be my error even thought I can't understand why it took till now to show up. Anyway, I've got it working and that is the most important thing.

[much later]

I have just upgraded to El Capitan and XCode 7.01 and I suspect the size/spacing of the gadgets is slightly different. I've noticed this in two of my programs so far.
Last edited by WilliamL on Sun Oct 25, 2015 7:07 pm, edited 1 time in total.
MacBook Pro-M1 (2021), Sonoma 14.4.1, PB 6.10LTS M1
User avatar
mk-soft
Always Here
Always Here
Posts: 5393
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: [5.40x64]-ListViewGadget not scrolling all the way down

Post by mk-soft »

Least found. Sometimes not so simple :wink:
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply