It is currently Sat May 25, 2013 8:29 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 429 posts ]  Go to page Previous  1 ... 17, 18, 19, 20, 21, 22, 23 ... 29  Next
Author Message
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Thu Apr 22, 2010 7:04 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 238
Location: BARCELONA - SPAIN
:) Hi,
I'm testing the Filter Callback Function (in windows 7 and PB 4.41) using this code:
Code:
Procedure MyFilterCallback(GadgetNumber.l, FilterString.s, ListIconColumn.l, EventCode.l) ; simple search example
  Protected itemNumber.l, I.l
 
  Debug FilterString
 
  If FilterString
    itemNumber = -1
    If IsGadget(GadgetNumber)
      ; Search for string
      For I = 0 To CountGadgetItems(GadgetNumber) - 1
        If FilterString = GetGadgetItemText(GadgetNumber, I, ListIconColumn)
          itemNumber = I
          Break
        EndIf
      Next
      ;
      If itemNumber <> -1 ; if string found, scroll to row
        PureLVSORT_ScrollToRow(GadgetNumber, itemNumber)
        SetGadgetItemState(GadgetNumber, itemNumber, GetGadgetItemState(GadgetNumber, itemNumber) | #PB_ListIcon_Selected)
      EndIf
    EndIf
  EndIf
EndProcedure
;
#Window_0 = 0
#ListIcon_0 = 0
;
Procedure Open_Window_0()
  If OpenWindow(#Window_0, 216, 0, 602, 302, "PureLVSORT Test",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
      ListIconGadget(#ListIcon_0, 5, 5, 590, 285, "String", 110)
      AddGadgetColumn(#ListIcon_0, 1, "Numeric", 110)
      AddGadgetColumn(#ListIcon_0, 2, "Float", 110)
      AddGadgetColumn(#ListIcon_0, 3, "DateDDMMYYYY", 120)
      AddGadgetColumn(#ListIcon_0, 4, "DateMMDDYYYY", 120)
      AddGadgetItem(#ListIcon_0, -1, "ABCDE" + Chr(10) + "514" + Chr(10) + "0.9" + Chr(10) + "31/12/2004" + Chr(10) + "12/31/2004")
      AddGadgetItem(#ListIcon_0, -1, "ACDEF" + Chr(10) + "118" + Chr(10) + "1.9" + Chr(10) + "11/12/2004" + Chr(10) + "12/11/2004")
      AddGadgetItem(#ListIcon_0, -1, "ZABCD" + Chr(10) + "-414" + Chr(10) + "7.0" + Chr(10) + "21/01/2003" + Chr(10) + "01/21/2003")
      AddGadgetItem(#ListIcon_0, -1, "DEFGH" + Chr(10) + "524" + Chr(10) + "900" + Chr(10) + "10/06/2001" + Chr(10) + "06/10/2001")
  EndIf
EndProcedure
;
Open_Window_0()
;
If PureLVSORT_SelectGadgetToSort(#ListIcon_0, #PureLVSORT_ShowClickedHeader_IconLeft) = #PureLVSORT_Ok
  PureLVSORT_SetColumnType(#ListIcon_0, 0, #PureLVSORT_String) ; default, not necessary
  PureLVSORT_SetColumnType(#ListIcon_0, 1, #PureLVSORT_Numeric)
  PureLVSORT_SetColumnType(#ListIcon_0, 2, #PureLVSORT_Float)
  PureLVSORT_SetColumnType(#ListIcon_0, 3, #PureLVSORT_DateDDMMYYYY)
  PureLVSORT_SetColumnType(#ListIcon_0, 4, #PureLVSORT_DateMMDDYYYY)
  PureLVSORT_SortListIconNow(#ListIcon_0, 3, 1)
  PureLVSORT_DefineFilterCallback(@MyFilterCallback())
  PureLVSORT_SetFilterTimeOut(100)
  PureLVSORT_SetFilter(#ListIcon_0)
EndIf
;
Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
End



and I have found that when I erase a previous FilterString entered by keyboard, the callback function receive a FilterString strange (look at "Debug FilterString "), that is not "" (empty).

Thats only occurs in W7! in WXPSP3 all runs fine.

Thanks for your help

_________________
QuimV


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Fri Apr 23, 2010 11:33 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4231
Location: Strasbourg / France
QuimV wrote:
:) Hi,
I'm testing the Filter Callback Function (in windows 7 and PB 4.41) ... and I have found that when I erase a previous FilterString entered by keyboard, the callback function receive a FilterString strange (look at "Debug FilterString "), that is not "" (empty).
Thats only occurs in W7! in WXPSP3 all runs fine.
I don't have Se7en, so I can only imagine what's going wrong.
Anyway, I made a little change.
Could you test http://freenet-homepage.de/gnozal/PureLVSORT_TEST.zip (PB4.50 ANSI library version, copy to \PureBasic450\PureLibraries\UserLibraries\) ?

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Fri Apr 23, 2010 12:21 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 238
Location: BARCELONA - SPAIN
:( Hi gnozal,

The behaviour continue being wrong. I mean that when I erase the string entered by the keyboard, the gadget callback function receive a string different from "" (void string), in fact the string received by the callback function is garbage.

Thanks

_________________
QuimV


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Fri Apr 23, 2010 12:55 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4231
Location: Strasbourg / France
QuimV wrote:
:( Hi gnozal,

The behaviour continue being wrong. I mean that when I erase the string entered by the keyboard, the gadget callback function receive a string different from "" (void string), in fact the string received by the callback function is garbage.

Ok another try : I have updated http://freenet-homepage.de/gnozal/PureLVSORT_TEST.zip (PB4.50 ANSI library version, copy to \PureBasic450\PureLibraries\UserLibraries\).

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Fri Apr 23, 2010 1:21 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 238
Location: BARCELONA - SPAIN
:( Nothing good. The same behaviour.
Thanks

_________________
QuimV


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Fri Apr 23, 2010 1:33 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4231
Location: Strasbourg / France
QuimV wrote:
:( Nothing good. The same behaviour.
Thanks

ye old code looks like this (ANSI PB4.xx version)
Code:
...
        ElseIf *pNMHdr\hdr\code = #HDN_FILTERCHANGE Or *pNMHdr\hdr\code = #HDN_FILTERBTNCLICK ; filter string changed
          ; hHDItem.HDITEM, TFilter.HDTEXTFILTER
          TmpHeaderText = Space(#MAX_pszText + 1)
          TFilter\pszText = @TmpHeaderText
          TFilter\cchTextMax = #MAX_pszText
          hHDItem\mask = #HDI_FILTER
          hHDItem\type = #HDFT_ISSTRING
          hHDItem\pvFilter = @TFilter
          hHeader = SendMessage_(WindowId, #LVM_GETHEADER, 0, 0) ; <--- get header handle
          If hHeader
            SendMessage_(hHeader,#HDM_GETITEM,*pNMHdr\iItem,@hHDItem) ; <--- get filter text
            If PureLVSORT_FilterCallBack
              CallFunctionFast(PureLVSORT_FilterCallBack, GetDlgCtrlID_(WindowId), TFilter\pszText, *pNMHdr\iItem, *pNMHdr\hdr\code) ; passes info to the user callback
...
I don't know where the problem might be...

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Fri Apr 23, 2010 7:28 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 238
Location: BARCELONA - SPAIN
Hi,

Would it be possible that you send a number to the callback filter function (TFilter\pszText) while the function should receive a string?

Code:
Procedure MyFilterCallback(GadgetNumber.l, FilterString.s, ListIconColumn.l, EventCode.l)

   TFilter\pszText = @TmpHeaderText

CallFunctionFast(PureLVSORT_FilterCallBack, GetDlgCtrlID_(WindowId), TFilter\pszText, *pNMHdr\iItem, *pNMHdr\hdr\code) ; passes info to the user callback



The problem always appears when the string is zero lenght an only in this case,

:o I'm sorry, I don't know enough programming to be more efective helping you.

Thanks

_________________
QuimV


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Sat Apr 24, 2010 9:32 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4231
Location: Strasbourg / France
QuimV wrote:
Would it be possible that you send a number to the callback filter function (TFilter\pszText) while the function should receive a string?
It is correct imho, it's a pointer to a zero terminated string.
But maybe it's an issue with CallFunctionFast() and Se7en.
I used a prototype instead in this new test lib : http://freenet-homepage.de/gnozal/PureLVSORT_TEST.zip (PB4.50 ANSI library version, copy to \PureBasic450\PureLibraries\UserLibraries\). Please test.

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Sat Apr 24, 2010 2:27 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 238
Location: BARCELONA - SPAIN
:( Same behaviour. Garbage instead nullstring.

_________________
QuimV


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Sat Apr 24, 2010 3:30 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 238
Location: BARCELONA - SPAIN
gnozal,
Would it be possible to insert a debug message showing the text filter, at the place marked witn an *** in order to control the text filter that your library has received?

ElseIf *pNMHdr\hdr\code = #HDN_FILTERCHANGE Or *pNMHdr\hdr\code = #HDN_FILTERBTNCLICK ; filter string changed
; hHDItem.HDITEM, TFilter.HDTEXTFILTER
TmpHeaderText = Space(#MAX_pszText + 1)
TFilter\pszText = @TmpHeaderText
TFilter\cchTextMax = #MAX_pszText
hHDItem\mask = #HDI_FILTER
hHDItem\type = #HDFT_ISSTRING
hHDItem\pvFilter = @TFilter
hHeader = SendMessage_(WindowId, #LVM_GETHEADER, 0, 0) ; <--- get header handle
If hHeader
SendMessage_(hHeader,#HDM_GETITEM,*pNMHdr\iItem,@hHDItem) ; <--- get filter text

***
If PureLVSORT_FilterCallBack
CallFunctionFast(PureLVSORT_FilterCallBack, GetDlgCtrlID_(WindowId), TFilter\pszText, *pNMHdr\iItem, *pNMHdr\hdr\code) ; passes info to the user callback

Thank You

_________________
QuimV


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Sat Apr 24, 2010 5:41 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 238
Location: BARCELONA - SPAIN
Hi gnozal,

Testing EditCallback function (with W7_32 and PB4.50) I get the next error messages:

- Constant not Found: Case #PureLVSORT_EditStart
- Constant not Found: Case #PureLVSORT_EditText
- Constant not Found: Case #PureLVSORT_EditEnd
- Constant not Found: Case #PureLVSORT_EditEscape

Could you fix it?

Thanks in advanced

_________________
QuimV


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Mon Apr 26, 2010 10:55 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4231
Location: Strasbourg / France
Hi QuimV,
I have updated http://freenet-homepage.de/gnozal/PureLVSORT_TEST.zip.
It includes a fixed resident (for the missing constants) and a new library version, which shows the text filter that the library has received as a warning.
Code:
Import "Debugger.lib"
  DebugWarning(szError.s) As "_PB_DEBUGGER_SendWarning@4"
EndImport
...
            SendMessage_(hHeader,#HDM_GETITEM,*pNMHdr\iItem,@hHDItem)
            FilterText = PeekS(TFilter\pszText)
            ;
            DebugWarning("TFilter\pszText = '" + FilterText + "'")
            ;
            If PureLVSORT_FilterCallBack
              PureLVSORT_FilterCallBack(GetDlgCtrlID_(WindowId), FilterText, *pNMHdr\iItem, *pNMHdr\hdr\code)
...
You have to use this library only with debugger enabled and with warning level = 'Display warnings'.

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Mon Apr 26, 2010 12:22 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 238
Location: BARCELONA - SPAIN
Hi @gnozal,

This is the debug output that I have received when I enter the string "DEFGH" and erase it letter by letter:

D
DE
DEF
DEFG
DEFGH
DEFG
DEF
DE
D
?/?/adgetStack_4194304

_________________
QuimV


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Mon Apr 26, 2010 4:37 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4231
Location: Strasbourg / France
QuimV wrote:
...
?/?/adgetStack_4194304
Seems the memory is corrupted somehow, but I have no clue why.... the Purifier doesn't catch any problem.
Only with an empty string, and only with Se7en !?
Another try (I have updated http://freenet-homepage.de/gnozal/PureLVSORT_TEST.zip) : I check the TFilter\pszText pointer with IsBadStringPtr_().

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
 
 Post subject: Re: PureLVSORT library : sorting ListIconGadgets (and more)
PostPosted: Tue Apr 27, 2010 8:38 am 
Offline
Enthusiast
Enthusiast

Joined: Mon May 29, 2006 11:29 am
Posts: 238
Location: BARCELONA - SPAIN
This is the result in debug screen, with the word "test".

t
te
tes
test
tes
te
t
C

_________________
QuimV


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 429 posts ]  Go to page Previous  1 ... 17, 18, 19, 20, 21, 22, 23 ... 29  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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