Forum | | | | - Page 1 - |
| Julian Schmidt | Hi, i'd gladly one Listbox create which numbers in the right Order indicating. about..
1,2,3...100,...1001,....9999 or too inverse. an integrally normal 'SortedListBox' shows numbers in this Order....
0,1,100,1000,2,200,2000,5000... if such a thing you don't say so is would I gladly whom highest worth of/ one Listbox(over a procedure)detect. CompileMarkSeparation |
| |
| | « this Posting watts as Solution marked. » | | Julian Schmidt | hmmmmmm....so can too the numbers in a list box sort, sees only not beautiful from :p prerequisite is naturally a 'UnsortedListbox'. CompileMarkSeparationWindowstyle 24
Window 100,200 - 100,200
Windowtitle "Beispiel zum Sortieren von Zahlen in einer Listbox"
var Liste&=Create("ListBox", %hwnd, 0, 0, 0, width(%hwnd), height(%hwnd)-40)
whileloop 100
AddString(Liste&,Str$((Rnd(20)*&loop)))
Endwhile
var sort_list&=Create("Button",%hwnd,"Sortieren",5,height(%hwnd)-35,width(%hwnd)-10,30)
while 1
waitinput
if getfocus(sort_list&)
Sort_Listbox_by_Number(Liste&)
EnableWindow sort_list&,0
Endif
Endwhile
Proc Sort_Listbox_by_Number
Parameters hdl&
declare index%
var num%=99999999999999999
var numbersortedlist&=Create("List", 0)
while GetCount(hdl&)<>0
whileloop GetCount(hdl&)
if num%>Val(GetString$(hdl&,&loop-1))
num%=Val(GetString$(hdl&,&loop-1))
index%=&loop-1
Endif
Endwhile
AddString(numbersortedlist&,Str$(num%))
DeleteString(hdl&,index%)
num%=99999999999999999
Endwhile
Whileloop GetCount(numbersortedlist&)
AddString(hdl&,GetString$(numbersortedlist&,&loop-1))
Endwhile
destroywindow(numbersortedlist&)
Return 1
../../function-references/XProfan/endproc/'>ENDPROC
Nachtrag: five Lines More, but for sees the sort rather from xD CompileMarkSeparationWindowstyle 24
Window 100,200 - 100,200
Windowtitle "Beispiel to that to testing. numbers in a Listbox"
var Liste&=Create("ListBox", %hwnd, 0, 0, 0, width(%hwnd), height(%hwnd)-40)
whileloop 100
AddStrings(Liste&,Str $((Rnd(20)*&loop)))
Endwhile
var sort_list&=Create("Button",%hwnd,"Sortieren",5,height(%hwnd)-35,width(%hwnd)-10,30)
while 1
waitinput
if getfocus(sort_list&)
Sort_Listbox_by_Number(Liste&)
EnableWindow sort_list&,0
Endif
Endwhile
Proc Sort_Listbox_by_Number
Parameters hdl&,num%
declare index%
var numbersortedlist&=Create("List", 0)
var copy_orginal_list&=Create("List", 0)
Whileloop GetCount(hdl&)
AddStrings(copy_orginal_list&,GetString$(hdl&,&loop-1))
Endwhile
while GetCount(copy_orginal_list&)<>0
num%=99999999999999999
whileloop GetCount(copy_orginal_list&)
if num%>Val(GetString$(copy_orginal_list&,&loop-1))
num%=Val(GetString$(copy_orginal_list&,&loop-1))
index%=&loop-1
Endif
Endwhile
AddStrings(numbersortedlist&,Str $(num%))
DeleteString(copy_orginal_list&,index%)
Endwhile
ClearList hdl&
Whileloop GetCount(numbersortedlist&)
AddStrings(hdl&,GetString$(numbersortedlist&,&loop-1))
Endwhile
destroywindow(numbersortedlist&)
destroywindow(copy_orginal_list&)
Return 1
ENDPROC
my question have I so To of my 100% Zufriedenstellung answers. The Thread is so closed! |
| | | | | |
| | Dietmar Horn | Hello Julian,
i'd The To sortierenden numbers with führenden nobodies top up and so of/ one sortierte Listbox to that Show throwing.
around the Sorting umzukehren would I any of the numbers of 1000, 10000, 100000, or so subtrahieren, and this then .The sortierte Listbox fill.
Greeting Dietmar |
| | | Multimedia für Jugendliche und junge Erwachsene - MMJ Hoyerswerda e.V. [...] Windows 95 bis Windows 7 Profan² 6.6 bis XProfan X2 mit XPSE Das große XProfan-Lehrbuch: [...] | 08/17/11 ▲ |
| |
| | Julian Schmidt | Dietmar horn (17.08.11)
i'd The To sortierenden numbers with führenden nobodies top up and so of/ one sortierte Listbox to that Show throwing.
whom commands can To such one object use? about stature$(...)?
Nachtrag: Have now simply time a procedure written which The supreme number of/ one Listbox determined. this is for my trouble already The Solution! CompileMarkSeparationcls
var Liste&=Create("ListBox", %hwnd, 1, 0, 0, 100, height(%hwnd))
whileloop 100
AddString(Liste&,Str$((Rnd(20)*&loop)))
Endwhile
Create("Text",%hwnd,"Largest Number of Listbox: "+Str$(Listbox_Largest_Number(Liste&)),110,10,230,18)
Create("Text",%hwnd,"Smallest Number of Listbox: "+Str$(Listbox_Smallest_Number(Liste&)),110,30,230,18)
while 1
waitinput
Endwhile
Proc Listbox_Largest_Number
Parameters hdl&
declare num%
whileloop GetCount(hdl&)
case num%<Val(GetString$(hdl&,&loop-1)) : num%=Val(GetString$(hdl&,&loop-1))
Endwhile
Return num%
EndProc
Proc Listbox_Smallest_Number
Parameters hdl&
var num%=99999999999999999
whileloop GetCount(hdl&)
case num%>Val(GetString$(hdl&,&loop-1)) : num%=Val(GetString$(hdl&,&loop-1))
Endwhile
Return num%
ENDPROC
|
| | | | |
| | Julian Schmidt | hmmmmmm....so can too the numbers in a list box sort, sees only not beautiful from :p prerequisite is naturally a 'UnsortedListbox'. CompileMarkSeparationWindowstyle 24
Window 100,200 - 100,200
Windowtitle "Beispiel zum Sortieren von Zahlen in einer Listbox"
var Liste&=Create("ListBox", %hwnd, 0, 0, 0, width(%hwnd), height(%hwnd)-40)
whileloop 100
AddString(Liste&,Str$((Rnd(20)*&loop)))
Endwhile
var sort_list&=Create("Button",%hwnd,"Sortieren",5,height(%hwnd)-35,width(%hwnd)-10,30)
while 1
waitinput
if getfocus(sort_list&)
Sort_Listbox_by_Number(Liste&)
EnableWindow sort_list&,0
Endif
Endwhile
Proc Sort_Listbox_by_Number
Parameters hdl&
declare index%
var num%=99999999999999999
var numbersortedlist&=Create("List", 0)
while GetCount(hdl&)<>0
whileloop GetCount(hdl&)
if num%>Val(GetString$(hdl&,&loop-1))
num%=Val(GetString$(hdl&,&loop-1))
index%=&loop-1
Endif
Endwhile
AddString(numbersortedlist&,Str$(num%))
DeleteString(hdl&,index%)
num%=99999999999999999
Endwhile
Whileloop GetCount(numbersortedlist&)
AddString(hdl&,GetString$(numbersortedlist&,&loop-1))
Endwhile
destroywindow(numbersortedlist&)
Return 1
../../function-references/XProfan/endproc/'>ENDPROC
Nachtrag: five Lines More, but for sees the sort rather from xD CompileMarkSeparationWindowstyle 24
Window 100,200 - 100,200
Windowtitle "Beispiel to that to testing. numbers in a Listbox"
var Liste&=Create("ListBox", %hwnd, 0, 0, 0, width(%hwnd), height(%hwnd)-40)
whileloop 100
AddStrings(Liste&,Str $((Rnd(20)*&loop)))
Endwhile
var sort_list&=Create("Button",%hwnd,"Sortieren",5,height(%hwnd)-35,width(%hwnd)-10,30)
while 1
waitinput
if getfocus(sort_list&)
Sort_Listbox_by_Number(Liste&)
EnableWindow sort_list&,0
Endif
Endwhile
Proc Sort_Listbox_by_Number
Parameters hdl&,num%
declare index%
var numbersortedlist&=Create("List", 0)
var copy_orginal_list&=Create("List", 0)
Whileloop GetCount(hdl&)
AddStrings(copy_orginal_list&,GetString$(hdl&,&loop-1))
Endwhile
while GetCount(copy_orginal_list&)<>0
num%=99999999999999999
whileloop GetCount(copy_orginal_list&)
if num%>Val(GetString$(copy_orginal_list&,&loop-1))
num%=Val(GetString$(copy_orginal_list&,&loop-1))
index%=&loop-1
Endif
Endwhile
AddStrings(numbersortedlist&,Str $(num%))
DeleteString(copy_orginal_list&,index%)
Endwhile
ClearList hdl&
Whileloop GetCount(numbersortedlist&)
AddStrings(hdl&,GetString$(numbersortedlist&,&loop-1))
Endwhile
destroywindow(numbersortedlist&)
destroywindow(copy_orginal_list&)
Return 1
ENDPROC
my question have I so To of my 100% Zufriedenstellung answers. The Thread is so closed! |
| | | | |
| | Julian Schmidt | Dietmar horn (17.08.11)
around the Sorting umzukehren would I any of the numbers of 1000, 10000, 100000, or so subtrahieren, and this then .The sortierte Listbox fill.
Subtrahieren? Multiplizieren! |
| | | | |
| | Thomas Freier |
i'd The To sortierenden numbers with führenden nobodies top up and so of/ one sortierte Listbox to that Show throwing.
mostly is a Font with same Laufweite present, then geht's too with space. CompileMarkSeparationcls
var LB&=Create("ListBox", %hwnd, 1, 10, 10, 224, 400)
var LBfont&=CreateFont("DejaVu Sans Mono",14,0,0,0,0)
SetFont LB&,LBfont&
var a$=space$(20)
AddString(LB&,right$(a$+"100",20))
AddString(LB&,right$(a$+"1",20))
AddString(LB&,right$(a$+"11",20))
AddString(LB&,right$(a$+"4",20))
waitinput
DeleteObject LBfont&
CompileMarkSeparation $H commctrl.ph
cls
var LB&=Create("GridBox", %hwnd,";1;220;"; 1, 10, 10, 224, 400)
setstyle LB&,getstyle(LB&) | ~LVS_NOCOLUMNHEADER
var LBfont&=CreateFont("Arial",14,0,0,0,0)
SetFont LB&,LBfont&
var a$=space$(20)
AddStrings(LB&,right$(a$+"100",20))
AddStrings(LB&,right$(a$+"1",20))
AddStrings(LB&,right$(a$+"11",20))
AddStrings(LB&,right$(a$+"4",20))
waitinput
DeleteObject LBfont&
end
|
| | | Gruß Thomas Windows XP SP2, XProfan X2 | 08/17/11 ▲ |
| |
|
AnswerTopic-Options | 10.387 Views |
Themeninformationenthis Topic has 3 subscriber: |