Source wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt:
Controls: mehrere Controls in einem Rebar-Band
Versionsnummer: 0.00
letzte Bearbeitung: Burghammer, der 16. Juni 2007
(C) 2007 by Nico Madysa
Mail: uebertreiber@gmx.de
als Demo für die MMJ-Quellcode-Sammlung bearbeitet und angepaßt von Dietmar Horn
alle benötigten Header-Dateien finden Sie im Ordner ProfmanSystem
$H Windows.ph
$H Messages.ph
$H Structs.ph
$H xprfctrl.ph
declare inum% , a# , OWin#
declare inum%,OWin#
Struct Titel = datei$(255) , titel$(20) , interpret$(20) ,
type% , laenge& , mompos&
Struct OSVERSIONINFO = ~OSVERSIONINFO
Struct shf = x1&,Icon&,x2&,Name$(259),Typ$(100)
Struct TV = Parent&,InsertAfter&,Mask&,Item&,State&,StateMask&,Text&,TextMax&,Icon1&,Icon2&,Children&,Data&,Text$(100)
Struct Hit = x&,y&,Flags&,Item&
Def %STDX 620
Def %STDY 460
Struct ReBar = Size& , Mask& , Style& , clrFore& , clrBack& ,
lpText& , cch& , iImage& , hwndChild& , cxMinChild& ,
cyMinChild& , cx& , hbmBack& , wID& , cyChild& ,
cyMaxChild& , cyIntegral& , cxIdeal& , lParam& ,
cxHeader& , handle& , bandcount%
subproc Create.ReBar
parameters rebar# , pWnd& , x% , y% , dx% , dy% , minx% , bx% , by% , cWnd& , fbgrip%
declare rebar&
rebar# : Auf ReBar (Struktur am Anfang der INC) dimensionierte Strukturvariable
pWnd& : übergeordnetes Fenster
x%,y% : obere, linke Ecke des zu behandlenden Bereiches
dx%,dy%: Außmaße des ReBar-Bereiches
Alle folgenden Parameter sind für das ertse Band des ReBar-Windows
minx% : minimale Breite des Bandes
bx% : Standart-Breite des Bandes
by% : Höhe des Bandes
cWnd& : Handle des Controls, das dem Band einbezogen wird
fbgrip%: wenn 1, erhält das erste Band auch einen Griff
if lower$(ClassOf(ReBar#)) = rebar
inc inum%
rebar&=Control(ReBarWindow32,,$50000804 ,x%,y%,dx%,dy%,pWnd&,inum%,0)
With Rebar#
.Size& = SizeOf(ReBar#) - 6
.Mask& = $71--RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE
.cyMaxChild& = 1 ------------------Darf nicht Null sein
.Style& = if(fbgrip%,128,256)--RBBS_NOGRIPPER (1. Band ohne Griff)
.cxMinChild& = minx%----------------Minimum Breite
.cyMinChild& = by%------------------Höhe des Bandes
.cx& = bx%------------------Vorgabe Breite
.hwndChild& = cWnd&----------------Band 1
SendMessage(ReBar&,$0401,0,ReBar#)--RB_INSERTBAND
.handle& = rebar&
.bandcount% = 1
EndWith
return 1
else
return 0
endif
endproc
ReBar# , minx% , bx% , by% , cWnd&
proc InsertReBarBand
parameters ReBar# , minx% , bx% , by% , cWnd&
minx% : minimale Breite des Bandes
bx% : Standart-Breite des Bandes
by% : Höhe des Bandes
cWnd& : Handle des Controls, das dem Band einbezogen wird
declare erg%
if lower$(ClassOf(ReBar#)) = rebar
With ReBar#
.Style& = 128-----------------RBBS_GRIPPERALWAYS (folgende Bänder mit Griff)
.cxMinChild& = minx%---------------Minimum Breite
.cyMinChild& = by%-----------------Höhe des Bandes
.cx& = bx%-----------------Vorgabe Breite
.hwndChild& = cWnd&---------------Band 2
erg% = SendMessage(.handle&,$0401,.bandcount%,ReBar#)--RB_INSERTBAND
.bandcount% = .bandcount% + 1
EndWith
return erg%
else
return 0
endif
endproc
Destruktor
rebar# : Auf ReBar dimensionierter Bereich
proc DestroyReBar
parameters rebar#
if lower$(ClassOf(rebar#)) = rebar
DestroyWindow(rebar#.handle&)
else
return 0
endif
endproc
proc OptWindow
if (Upper$($(1)) = START HWND) or (Upper$($(1)) = START)
parameters w$ , style% , titel$ , dx% , dy%
Dim OWin# , 4 + 4 + 4
clear OWin#
WindowTitle titel$
WindowStyle style%
Window %MaxX , %MaxY - dx% , dy%
cls External(USER32,GetSysColor,15)
Long OWin# , 0 = %hWnd
Long OWin# , 4 = dx%
Long OWin# , 8 = dy%
elseif Upper$($(1)) = START WIN
parameters w$ , pWnd& , style% , titel$ , dx% , dy%
declare hwin&
Dim OWin# , 4 + 4 + 4
clear OWin#
WindowStyle style%
hwin& = Create(Window,pWnd&,titel$,%MaxX,%MaxY,dx%,dy%)
Long OWin# , 0 = hwin&
Long OWin# , 4 = dx%
Long OWin# , 8 = dy%
return hwin&
elseif Upper$($(1)) = START DLG
parameters w$ , pWnd& , titel$ , dx% , dy%
declare hwin&
Dim OWin# , 4 + 4 + 4
clear OWin#
hwin& = Create(Dialog,pWnd&,titel$,%MaxX,%MaxY,dx%,dy%)
Long OWin# , 0 = hwin&
Long OWin# , 4 = dx%
Long OWin# , 8 = dy%
return hwin&
elseif Upper$($(1)) = END
if %pCount > 1
parameters x% , y%
declare hwin& , dx% , dy%
else
declare hwin& , x% , y% , dx% , dy%
endif
hwin& = Long(OWin#,0)
dx% = (2 * Long(OWin#,4)) - width(hwin&)
dy% = (2 * Long(OWin#,8)) - height(hwin&)
if %pCount = 1
x% = (%MaxX - dx%) / 2
y% = (%MaxY - dy%) / 2
endif
SetWindowPos hwin& = x% , y% - dx% , dy%
Dispose OWin#
endif
endproc
proc Resize
mmp_dx% = width(%hWnd)
mmp_dy% = height(%hWnd)
maindx% = mmp_dx% - 30
maindy% = mmp_dy% - 65
NavnPlay
SetWindowPos textpos& = 5 , (mmp_dy% - 55) - (mmp_dx% - 10) , 20
SetWindowPos trackpos& = 5 , (mmp_dy% - 30) - (mmp_dx% - 10) , 25
erste Seite
SetWindowPos tvdir& = 0 , 0 - ((maindx% - 10) / 3),(maindy% - 25)
SetWindowPos lbfile& = (( (maindx% - 10) / 3) + 4), 0 - ((maindx% - 10) / 3),(maindy% - 25)
SetWindowPos lblist& = ((2 * (maindx% - 10) / 3) + 9), 50 - ((maindx% - 10) / 3),(maindy% - 100)
SetWindowPos ename& = ((2 * (maindx% - 10) / 3) + 9), 0 - ((maindx% - 10) / 3), 20
SetWindowPos eauto& = ((2 * (maindx% - 10) / 3) + 9), 25 - ((maindx% - 10) / 3), 20
SetWindowPos blsav& = ((2 * (maindx% - 10) / 3) + 9),(maindy% - 45) - ((maindx% - 10) / 3), 20
SetWindowPos emomf& = 0 ,(maindy% - 20) - ((maindx% - 10) / 3), 20
SetWindowPos badd& = (( (maindx% - 10) / 3) + 4),(maindy% - 20) - ((maindx% - 10) / 3), 20
SetWindowPos bdel& = ((2 * (maindx% - 10) / 3) + 9),(maindy% - 20) - ((maindx% - 10) / 3), 20
zweite Seite
SetWindowPos cbloop& = 5 , 5 - (maindx% / 2), 20
SetWindowPos cbrand& = ( (maindx% / 2) + 5), 5 - (maindx% / 2), 20
SetWindowPos cbdnam& = 5 , 30 - (maindx% / 2), 20
SetWindowPos gbwind& = 5 , 60 - (maindx% - 10) , 50
SetWindowPos rbwin& = 15 , 80 - 100 , 20
SetWindowPos rbtray& = ( (maindx% / 2) + 5), 80 - 120 , 20
SetWindowPos gblist& = 5 , 120 - (maindx% - 10) ,130
SetWindowPos rbnix& = 15 , 140 - 150 , 20
SetWindowPos rblast& = 15 , 170 - 250 , 20
SetWindowPos rblist& = 15 , 200 - 170 , 20
SetWindowPos elist& = 190 , 200 - 200 , 20
SetWindowPos bwahl& = 390 , 200 - 100 , 20
SetWindowPos cbplay& = 32 , 220 - 250 , 20
SetWindowPos bosav& = ((0 * (maindx% - 15) / 4) + 0),(maindy% - 25) - ((maindx% - 15) / 4), 25
SetWindowPos bobak& = ((1 * (maindx% - 15) / 4) + 4),(maindy% - 25) - ((maindx% - 15) / 4), 25
SetWindowPos bosta& = ((2 * (maindx% - 15) / 4) + 9),(maindy% - 25) - ((maindx% - 15) / 4), 25
SetWindowPos babout& = ((3 * (maindx% - 15) / 4) + 14),(maindy% - 25) - ((maindx% - 15) / 4), 25
ReBar
SetWindowPos Main#.handle& = 5 , 5 - (maindx% + 20) , maindy%
endproc
proc Initialize
mmp_dx% = %STDX
mmp_dy% = %STDY
maindx% = mmp_dx% - 30
maindy% = mmp_dy% - 65
hfont& = Create(Font,Comic Sans MS,19,0,0,0,0)
SetDialogFont hfont&
endproc
proc BuildUp
declare thisexe$
OptWindow START HWND , (~PWS_THICKFRAME | ~PWS_DIALOG | ~PWS_SYSMENU | ~PWS_MINBOX | ~PWS_NOMENU) , Madysas Music Player (nur der Rebar-Demo-Source) , mmp_dx% , mmp_dy%
NavnPlay
textpos& = Create(Text,%hWnd,Liste: kein Name --- Autor: unbekannt --- Titel: keiner --- Position: 0:00 von 0:00,5,(mmp_dy% - 55),(mmp_dx% - 10),20)
trackpos& = Create(TrackBar,%hWnd,0;0;0,5,(mmp_dy% - 30),(mmp_dx% - 10),25)
erste Seite
pone& = Control(DIALOG,,$50000000,0,0,0,0,%hWnd,1000,%hInstance)
tvdir& = Control(SysTreeView32,,$50800037,0,0,((maindx% - 10) / 3),maindy% - 25,pone&,1001,%hInstance,$200)
lbfile& = Control(ListBox,,~lbs_Standart + ~lbs_ExtendedSel ,( (maindx% - 10) / 3) + 4, 0,((maindx% - 10) / 3),maindy% - 25,pone&,1002,%hInstance,$200)
lblist& = Control(ListBox,,~lbs_Standart + ~lbs_ExtendedSel - ~lbs_Sort,(2 * (maindx% - 10) / 3) + 9,50,((maindx% - 10) / 3),maindy% - 100,pone&,1003,%hInstance,$200)
ename& = Create(Edit ,pone&, ,(2 * (maindx% - 10) / 3) + 9, 0,(maindx% - 10) / 3,20)
eauto& = Create(Edit ,pone&, ,(2 * (maindx% - 10) / 3) + 9, 25,(maindx% - 10) / 3,20)
blsav& = Create(Button,pone&,Liste sichern,(2 * (maindx% - 10) / 3) + 9,maindy% - 45,(maindx% - 10) / 3,20)
emomf& = Create(Edit ,pone&, , 0 ,maindy% - 20,(maindx% - 10) / 3,20)
badd& = Create(Button,pone&,>>> Hinzufügen >>>,( (maindx% - 10) / 3) + 4,maindy% - 20,(maindx% - 10) / 3,20)
bdel& = Create(Button,pone&,<<< Entfernen <<< ,(2 * (maindx% - 10) / 3) + 9,maindy% - 20,(maindx% - 10) / 3,20)
zweite Seite
ptwo& = Control(DIALOG,,$50000000,0,0,0,0,%hWnd,1000,%hInstance)
cbloop& = Create(CheckBox,ptwo&,Liste wiederholen ,5 ,5,maindx% / 2,20)
cbrand& = Create(CheckBox,ptwo&,Liste zufällig ordnen,5 + (maindx% / 2),5,maindx% / 2,20)
cbdnam& = Create(CheckBox,ptwo&,Dateinamen der Titel anzeigen,5,30,maindx% / 2,20)
gbwind& = Create(GroupBox,ptwo&,Beim Programmstart dieses Fenster...,5,60,maindx% - 10,50)
rbwin& = Create(RadioButton,ptwo&,... öffnen,15,80,100,20)
rbtray& = Create(RadioButton,ptwo&,... nicht öffnen,315,80,120,20)
gblist& = Create(GroupBox,ptwo&,Bei Programmstart...,5,120,maindx% - 10,130)
rbnix& = Create(RadioButton,ptwo&,...keine Liste laden,15,140,150,20)
rblast& = Create(RadioButton,ptwo&,...die zuletzt benutzte Liste laden,15,170,250,20)
rblist& = Create(RadioButton,ptwo&,...folgende Liste laden:,15,200,170,20)
elist& = Create(Edit,ptwo&,,190,200,200,20)
bwahl& = Create(Button,ptwo&,Durchsuchen,390,200,100,20)
cbplay& = Create(CheckBox,ptwo&,Liste bei Programmstart abspielen,32,220,250,20)
bosav& = Create(Button,ptwo&,Optionen sichern ,(0 * (maindx% - 15) / 4) + 0,maindy% - 25,(maindx% - 15) / 4,25)
bobak& = Create(Button,ptwo&,Abbrechen ,(1 * (maindx% - 15) / 4) + 4,maindy% - 25,(maindx% - 15) / 4,25)
bosta& = Create(Button,ptwo&,Standard herstellen,(2 * (maindx% - 15) / 4) + 9,maindy% - 25,(maindx% - 15) / 4,25)
babout& = Create(Button,ptwo&,Über den MMP ,(3 * (maindx% - 15) / 4) + 14,maindy% - 25,(maindx% - 15) / 4,25)
ReBar
Create(ReBar,Main#,%hWnd,5,5,maindx% + 20,maindy%,0,maindx%,maindy%,pone&,1) Diese Zeile ist fürs fertige Programm gedacht
Create(ReBar,Main#,%hWnd,5,5,maindx% + 20,maindy%,0,100,maindy%,pone&,1) Diese Zeile nur fürs Demo, damit man die Controls beim Programmstart gleich sieht
InsertReBarBand Main# , 0 , (maindx% - 100) , maindy% , ptwo&
OptWindow END
endproc
proc Beenden
DestroyReBar(Main#)
Dispose Main#
Dispose CurTitle#
Dispose Tv#
Dispose SHF#
Dispose Hit#
end
endproc
--- H a u p t p r o g r a m m ----------------------------------
Handles
Fonts
declare hfont&
Hauptteil
1. Seite
declare pone& , tvdir& , lbfile& , ename& , eauto& , lblist&
declare blsav& , emomf& , badd& , bdel& , lbivi&
2. Seite
declare ptwo& , cbloop& , cbrand& , cbdnam& , babout&
declare gbwind& , rbwin& , rbtray& , gblist& , rbnix&
declare rblast& , rblist& , elist& , bwahl& , cbplay&
declare bosav& , bobak& , bosta&
NavnPlay
declare back& , forw& , plst& , paus&
declare textpos& , trackpos&
Variablen
declare mmp_ende% , mmp_x% , mmp_y% , mmp_dx% , mmp_dy%
declare maindx% , maindy% , NextItem& , curItem& , Root& , IcoList&
Pseudo-Konstanten
declare main_message%
Strukturierte Bereiche und Klassen
declare CurTitle# , Main# , SHF# , Tv# , Hit#
Dim CurTitle# , Titel
Dim Main# , ReBar
Dim Tv# , TV
Dim SHF# , shf
Dim Hit# , Hit
clear Main# , shf# , Tv# , hit#
Initialize
BuildUp
whilenot mmp_ende%
waitinput
main_message% = %Message
Veränderungen
EnableWindow elist& , GetCheck(rblist&)
EnableWindow bwahl& , GetCheck(rblist&)
EnableWindow cbplay& , GetCheck(rblist&)
Aktionen
if (%Key = 2) or MenuItem(-4000) or (main_message% = ~wm_Close) or (main_message% = ~wm_Quit)
mmp_ende% = 1
elseif %Key = 4
Resize
endif
wend
Beenden
Ende des MMP