Scrolling ListIcon in Linux

Linux specific forum
chen
Enthusiast
Enthusiast
Posts: 338
Joined: Fri Dec 23, 2005 2:20 pm
Location: Quebec, Canada
Contact:

Scrolling ListIcon in Linux

Post by chen »

I need some help here,

Im developing and app Win/Linux. Win version is almost done, 99% Pure PB
commands, but I have a small( or big) problem.

Someone could post a small example of how to scroll a ListIcon Gadget
in Linux?

Suppose my ListIcon can show 10 records at a time, Im searching for a record
that is placed in the row 15, how I make it scroll to row 15 and show it in
the ListIcon visible screen?

Thanks for your help...
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

use

Code: Select all

SetGadgetState(#ListIcon,n)
where n is the desired entry....

Is this what you need? or do I missunderstand the question... :roll:
chen
Enthusiast
Enthusiast
Posts: 338
Joined: Fri Dec 23, 2005 2:20 pm
Location: Quebec, Canada
Contact:

Post by chen »

I had some problems with my PC.... but Im back again...
walker wrote:use

Code: Select all

SetGadgetState(#ListIcon,n)
where n is the desired entry....

Is this what you need? or do I missunderstand the question... :roll:
No, is not... Im bad to explain what I want...

I have a ListIcon which can show 10 records at a time... suppose that I have 20 records.

A user enter in a StringGadget some text and press a ButtonGadget to
start the search.... it happens the search is a success and the record is the
15 row .

The program find the record and select it, but it is out of screen at the
bottom. How can I program this part to scroll down find the row 15 and
show it in the screen.
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

Try the following

Code: Select all

OpenWindow(0,10,10,150,250,"searchtest",#PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
    StringGadget(0,10,10,100,25,"")
    ListIconGadget(1,10,40,120,200,"MyData",99)
    
    AddGadgetItem(1,-1,"")
    For m= 0 To 200
        AddGadgetItem(1,-1,Str(m)+"_dataentry")
    Next

EndIf

SetActiveGadget(0)
Repeat
event= WaitWindowEvent(1)
If event=#PB_Event_Gadget
    Select EventGadget()
        Case 0
            search.s=GetGadgetText(0)
            l=Len(search.s)
            If search.s<>""
                For n= 0 To CountGadgetItems(1)-1
                    If Left(LCase(GetGadgetItemText(1,n)),l) = LCase(search.s)
                        SetGadgetItemState(1,n,#PB_ListIcon_Selected)
                        SetGadgetState(1,n)
                        CompilerIf #PB_Compiler_OS = #PB_OS_Windows
                            SendMessage_(GadgetID(1), #LVM_ENSUREVISIBLE, n, 0) 
                        CompilerElse 
            ;               on Linux no else is needed
            ;               on MacOs... don't know                              
                        CompilerEndIf 
                        Break; if found
                    EndIf
                Next
            Else
                SetGadgetState(1,0)
            EndIf
        Default
            ;nothing to do
    EndSelect
 EndIf
Until event=#PB_Event_CloseWindow
type a number not visible on the screen (i.e. 99) in the stringfiled and the appropriate entry is shown... 8)
chen
Enthusiast
Enthusiast
Posts: 338
Joined: Fri Dec 23, 2005 2:20 pm
Location: Quebec, Canada
Contact:

Post by chen »

I appreciate a lot your help.... the example works and Im going to incorporate
to my app...

thanks Walker :wink:
Post Reply