Hi,
I want to sort the array using cargo, but I dont understand it works, and I'm not able to do it.
// ======================================================================
function Calendar(fonction)
// ======================================================================
local oFont := HFont():Add( "Serif",0,-13 ), oIcon
local cTitle := "Calendrier"
local csearch:="", false:=.f., true:=.t.
public oRepas, oCalendar, ndays, cJour, cMois, cAn, bInit:=.t., numcal, mydate, o
public bChange := {||
RecupPeriode()
return .T.
}
oIcon := HIcon():AddFile( cImageDir+"calendrier.png" )
INIT DIALOG oRepas CLIPPER NOEXIT TITLE cTitle AT oMainWindow:nLeft+100,oMainWindow:nTop+130 SIZE 660,230 ;
FONT oFont ICON oIcon
// Taille fixe
hwg_WindowSetResize( oRepas:handle, .F. )
hwg_SetDlgKey( oRepas, 0, VK_F1, {|| Help("Calendar") } )
numcal=1
@ 10, 10 MONTHCALENDAR oCalendar SIZE 300, 160 ON CHANGE bChange TOOLTIP "Cliquez sur une date" INIT date()
@ 320,9 BROWSE oBrwCal ARRAY SIZE 330,160 STYLE WS_BORDER ;
ON SIZE ANCHOR_TOPABS + ANCHOR_LEFTABS + ANCHOR_RIGHTABS + ANCHOR_BOTTOMABS ;
ON POSCHANGE {|o|numcal:=o:nCurrent,Repas()} ;
ON CLICK {|o|numcal:=o:nCurrent,Menu(aRepas[numcal,1],aRepas[numcal,2],aRepas[numcal,3])} ;
ON UPDATE {|o|oBrwCal:Refresh(),numcal:=o:ncurrent,Repas()}
oBrwCal:aArray := aRepas
oBrwCal:AddColumn( HColumn():New( " Date ", {|v,o|o:aArray[o:nCurrent,1]},"C",15,0 ) )
oBrwCal:AddColumn( HColumn():New( " Invités ", {|v,o|o:aArray[o:nCurrent,2]},"C",50,0 ) )
@ 205,190 BUTTON "Nouveau" OF oRepas ON CLICK {||NewRepas()} ;
SIZE 100, 32 COLOR hwg_ColorC2N("FF0000")
@ 325,190 BUTTON "Fermer" OF oRepas ID IDCANCEL ;
SIZE 100, 32 COLOR hwg_ColorC2N("FF0000")
ACTIVATE DIALOG oRepas
oFont:Release()
return nil
Can you help me ?
Thanks
A+
Hello Alain,
at this time i had no solution, sorry.
But try this:
sort the array in the background with your own function or procedure,
afterwards call the Refresh() method of the HBROWSE class,
and the sorted array should now be visible.
Browsing a database this runs so with success:
I set with
SET ORDER TO ...
an new order (by index) and after refreshing
the BROWSE window shows the database withbthe new order.
See logw.prg of CLLOG.
Have success.
With regards,
MNI TNX, 73 es 55 de
DF7BE, Wilfried
Thanks, I have already try it and it works, but only on a column.
A solution without cargo, could be to have as functions with asort() for each column, but it is then necessary to have as buttons as columns to sort to call these functions.
I search for another solution ...
A+
Hello Alain,
yes, in my CLLOG main program there exists a menu "Sort order" to change
the order.
If you found a suitable solution, please inform me by this way,
at it's best with a sample program, so i can add it to the HWGUI samples
(also with pre check on Windows and MacOS)
With regards,
MNI TNX, 73 es 55 de
DF7BE, Wilfried
Am 2025-04-14 21:16, schrieb Aupeix Alain:
Links:
[1] https://sourceforge.net/p/hwgui/support-requests/88/
Related
Support Requests: #88
Hi,
I have tried to use cargo as made in sample in Hwgui Tutor
Here is the modified code :
But It fails when running :
Where line 101 is :
I don't find where is the problem ...
Thanks for your help
A+
It looks like z[nCol] or y[nCol] are out of array range. Check the nCol value and array structure - just add the hwg_writelog() calls to the onHeadClick()
Hi,
I just add a first column :
and return nil if the column to sort was the first column
I tried with the commented line(as in tutor), but it fails
So here is what is working :
I will put a sample that you will be able to improve and add to samples, but it would be nice that Alexander helps use concerning the first column ...
Thanks
A+
Last edit: Aupeix Alain 2025-04-15
Hi,
As Alexander said :
I have modified a bit to debug:
Here is the array :
And here is the log :
It crashes when clicking on the first column
And here is the last Error.log :
Thanks
A+
Last edit: Aupeix Alain 2025-04-15