It is currently Sun Jun 16, 2019 3:47 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 90 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6
Author Message
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Tue Jun 11, 2019 5:00 am 
Offline
User
User

Joined: Wed Mar 11, 2009 4:06 pm
Posts: 80
Location: NL
Impressive job. What's yet missing is full keyboard navigation.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Tue Jun 11, 2019 2:31 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Mar 25, 2004 2:15 pm
Posts: 658
Location: Spain
Rinzwind wrote:
Impressive job. What's yet missing is full keyboard navigation.
Yes! :D

I just coded this piece, but I don't know how to scroll the ListEx to display current position when the selected row goes beyond the bottom of the gadget.

Code:
Procedure key_up(listExID.l, steps.l = 1)
  Debug "key up!"
  Protected curPos.l 
 
  curPos = ListEx::GetState(listExID)
  If curPos > 0   
    curPos - steps
    If curPos < 0: curPos = 0: EndIf
    ListEx::SetState(listExID, curPos)
  EndIf 
EndProcedure

Procedure key_down(listExID.l, steps.l = 1)
  Debug "key down!"   
  Protected rowCount.l = 0
  Protected curPos.l
 
  rowCount = ListEx::CountItems(listExID)   
  curPos = ListEx::GetState(listExID) 
  If curPos < (rowCount - steps)
    curPos + steps
    If curPos > (rowCount - steps): curPos = (rowCount - steps): EndIf
    ListEx::SetState(listExID, curPos)   
  EndIf
EndProcedure 

#Window  = 0
Enumeration 1
  #List
  #MyEventKeyUP
  #MyEventKeyDOWN
EndEnumeration

If OpenWindow(#Window, 0, 0, 400, 300, "Window", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
 
  ListEx::Gadget(#List, 10, 10, 380, 280, "header", 360, "", ListEx::#GridLines)
  For cont = 1 To 30
    ListEx::AddItem(#List, ListEx::#LastItem, "Randy Roads")
    ListEx::AddItem(#List, ListEx::#LastItem, "Ozzy Osbourne")
  Next
 
  AddKeyboardShortcut(#Window, #PB_Shortcut_Up, #MyEventKeyUP)
  AddKeyboardShortcut(#Window, #PB_Shortcut_Down, #MyEventKeyDOWN)
 
  SetActiveGadget(#List)
  ListEx::SetState(#List,0)
 
  Repeat
    Event = WindowEvent()     
    MenuID = EventMenu()
    GadgetID = EventGadget()
    Select Event
       
      Case #PB_Event_Menu
        Select EventMenu()
          Case #myEventKeyDOWN
            If GetActiveGadget() = #List
              key_down(#List)
            EndIf
          Case #MyEventKeyUP
            If GetActiveGadget() = #List
              key_up(#List)
            EndIf         
        EndSelect
       
      Case #PB_Event_CloseWindow
      Case #PB_Event_Gadget
    EndSelect     
  Until Event = #PB_Event_CloseWindow
EndIf
CompilerEndIf

_________________
PB 5.7x, PureVision User.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Tue Jun 11, 2019 3:58 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 732
Location: Germany
Update:
  • SetState() moves now the row into the visible area

_________________
Sorry for my English. My language is German.
(Translated with http://www.DeepL.com/Translator)

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Tue Jun 11, 2019 4:21 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Mar 25, 2004 2:15 pm
Posts: 658
Location: Spain
Thorsten1867 wrote:
Update:
  • SetState() moves now the row into the visible area

Thank you :!:

With my previous example, It works fine with down-key, but not for up-key (selected row go out of visible area)
Image

:oops: Sorry for inconvenences

_________________
PB 5.7x, PureVision User.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Tue Jun 11, 2019 4:38 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 732
Location: Germany
I made a small change. Try it again!

_________________
Sorry for my English. My language is German.
(Translated with http://www.DeepL.com/Translator)

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Tue Jun 11, 2019 5:00 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Mar 25, 2004 2:15 pm
Posts: 658
Location: Spain
Thorsten1867 wrote:
I made a small change. Try it again!
Really thanks you!

Now it do a strange move:
Down-key is OK, but
first time UP-KEY is pressed it display from first row then, if you press UP-KEY again, it display the focused row
Image

_________________
PB 5.7x, PureVision User.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Tue Jun 11, 2019 5:09 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 732
Location: Germany
Update:
  • Key control (Up/Down, PageUp/PageDown, Home/End)
  • Bugfix

_________________
Sorry for my English. My language is German.
(Translated with http://www.DeepL.com/Translator)

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Tue Jun 11, 2019 5:51 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Mar 25, 2004 2:15 pm
Posts: 658
Location: Spain
Thorsten1867 wrote:
Update:
  • Key control (Up/Down, PageUp/PageDown, Home/End)
  • Bugfix

Nice! but I still have the same issue that I mentioned in the previous post. With 20 or 30 more rows, when you press key down everything goes well, but when you press key up makes the effect of the image I put in my previous post.

Really, thank you very much for all these changes!

_________________
PB 5.7x, PureVision User.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Tue Jun 11, 2019 6:50 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 732
Location: Germany
Try it again

_________________
Sorry for my English. My language is German.
(Translated with http://www.DeepL.com/Translator)

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Wed Jun 12, 2019 8:24 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Mar 25, 2004 2:15 pm
Posts: 658
Location: Spain
Edited/Updated

I think I found the issue: In Procedure SetVisible_(Row.i) I changed this line

ListEx()\Row\Offset = ListEx()\Row\Offset - Row to

ListEx()\Row\Offset = Row

And now everything seems to be fine (but I don't know if this change negatively affects other parts of code).

-------- ORIGINAL POST -------

Thorsten1867 wrote:
Try it again
The problem persists (PB 5.70, Windows10 x64) :(
I just added these lines to have more rows to try.
Code:
For cont = 1 To 100
  ListEx::AddItem(#List, ListEx::#LastItem, "Jack"     + #LF$ + "Jones"    + #LF$ + #LF$ + #LF$ + "Push")
Next

Image

Thank you for your effort and help!

_________________
PB 5.7x, PureVision User.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Wed Jun 12, 2019 11:01 am 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 732
Location: Germany
Update: Bugfix

The problem was a small mistake in thinking and the formula was really very simple. :shock:

_________________
Sorry for my English. My language is German.
(Translated with http://www.DeepL.com/Translator)

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Wed Jun 12, 2019 4:46 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Mar 25, 2004 2:15 pm
Posts: 658
Location: Spain
Nice, all ok with cursor and focused row :D

On the other hand, would it be possible, after sorting the list, to keep the focus of the current row?

Thank you very much and I'm sorry to be so boring! :oops:

_________________
PB 5.7x, PureVision User.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Wed Jun 12, 2019 6:26 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue May 26, 2009 2:11 pm
Posts: 575
Lord wrote:
...
Another thing:
Is it true, that ListEx::EventState(#List) in the example
always returns "0" when changing the three state checkbox?
In the meantime: has this been fixed?

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Wed Jun 12, 2019 6:46 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 732
Location: Germany
Update:
  • Restore focus after sorting

_________________
Sorry for my English. My language is German.
(Translated with http://www.DeepL.com/Translator)

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Modules] Editable and sortable ListGadget (all OS / DPI
PostPosted: Thu Jun 13, 2019 9:42 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Mar 25, 2004 2:15 pm
Posts: 658
Location: Spain
Thorsten1867 wrote:
Update:
  • Restore focus after sorting

:D Thank you!
I am really amazed at what you are able to do for some of the members of this forum!

_________________
PB 5.7x, PureVision User.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 90 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye