| Quelltexte/ Codesnippets |  |  |  |  |  |  |  | - Seite 1 - |  | 
 
 |  |  | | 
 Source wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt:Rebar: mehrere Controls in einem Rebar-BandVersionsnummer: 0.00letzte Bearbeitung: Burghammer, der 16. Juni 2007(C) 2007 by Nico MadysaMail: uebertreiber@gmx.deals Demo für die MMJ-Quellcode-Sammlung bearbeitet und angepaßt von Dietmar Hornalle benötigten Header-Dateien finden Sie im Ordner ProfmanSystem$H Windows.ph$H Messages.ph$H Structs.ph$H xprfctrl.phdeclare inum% , a# , OWin#declare inum%,OWin#Struct Titel = datei$(255) , titel$(20) , interpret$(20) ,                type% , laenge& , mompos&Struct OSVERSIONINFO = ~OSVERSIONINFOStruct 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 620Def %STDY 460Struct 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.ReBarparameters rebar# , pWnd& , x% , y% , dx% , dy% , minx% , bx% , by% , cWnd& , fbgrip%declare rebar&rebar# : Auf ReBar (Struktur am Anfang der INC) dimensionierte StrukturvariablepWnd&  : übergeordnetes Fensterx%,y%  : obere, linke Ecke des zu behandlenden Bereichesdx%,dy%: Außmaße des ReBar-BereichesAlle folgenden Parameter sind für das ertse Band des ReBar-Windowsminx%  : minimale Breite des Bandesbx%    : Standart-Breite des Bandesby%    : Höhe des BandescWnd&  : Handle des Controls, das dem Band einbezogen wirdfbgrip%: wenn 1, erhält das erste Band auch einen Griffif 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 0endifendprocReBar# , minx% , bx% , by% , cWnd&proc InsertReBarBandparameters ReBar# , minx% , bx% , by% , cWnd&minx%  : minimale Breite des Bandesbx%    : Standart-Breite des Bandesby%    : Höhe des BandescWnd&  : Handle des Controls, das dem Band einbezogen wirddeclare 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 0endifendprocDestruktorrebar# : Auf ReBar dimensionierter Bereichproc DestroyReBarparameters rebar#if lower$(ClassOf(rebar#)) = rebar DestroyWindow(rebar#.handle&)else return 0endifendprocproc OptWindowif (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 WINparameters 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 DLGparameters 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)) = ENDif %pCount > 1parameters x% , y%declare hwin& , dx% , dy%elsedeclare 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#endifendprocproc 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%endprocproc 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&endprocproc BuildUpdeclare 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 ENDendprocproc Beenden  DestroyReBar(Main#)  Dispose Main#  Dispose CurTitle#  Dispose Tv#  Dispose SHF#  Dispose Hit#  endendproc---   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#InitializeBuildUpwhilenot 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  endifwendBeendenEnde des MMP
 | 
 |  |  |  |  |  |  |  |  | 
 
 
 |  |  |  | « Dieser Beitrag wurde als Lösung gekennzeichnet. » |  |  |  |  Jörg
 Sellmeyer
 | | Repariert - leider sind keine Bitmaps dabei. Es reicht, Bilder (auch jpgs) ins Verzeichnis zu packen und die umzubenennen, damit man sieht, wie es gemeint ist.
 'Source wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt:
'RebarWindow (1)
'Rebarwindow aus Vorlage von Uwe Pascal Niemeier
'Erweitert von Rolf Koch
'Läuft bei mir einwandfrei mit der XProfan Version: 10.0ß-NT RC1
'putclip $profver
DEF GETSYSCOLOR(1) !"USER32","GetSysColor"
Def LoadCursor(2) !"USER32","LoadCursorA"
DEF SetClassLong(3) !"USER32","SetClassLongA"
DEF SetWindowLong(3) !"USER32","SetWindowLongA"
WINDOWSTYLE 63
WINDOWTITLE "Rebar Demo"
window 50,50-330,500
USEFONT "MS Sans Serif",13,0,0,0,0
SETDIALOGFONT 1
'SETTRUECOLOR 1
CLS
declare ReBar&,ReBar#,Lb1&,Lb2&,Lb3&,a#
dim a#,16
DECLARE a1&,b1&,c1&
DECLARE a2&,b2&,c2&,c3&
DECLARE a3&,b3&
Declare image&
declare button1&,button2&,button3&
declare hand&
hand&=LoadCursor(0,32649)
Lb1&=create("text",%hwnd,"1",0,0,0,0)
image&=create("hPic", -1,"S1.BMP")
button1&=create("BITMAP", lb1&, image&, 0, 0)
SetWindowLong(BUTTON1&,-16,$5000010E | 256)
SetClassLong(Button1&,-12,hand&)
a1&    = create("RADIOButton",lb1&,"Check Me Seite 1 A",0013,0033,0120,0017)
a2&    = create("RADIOButton",lb1&,"Check Me Seite 1 B",0013,0053,0120,0017)
a3&    = create("RADIOButton",lb1&,"Check Me Seite 1 C",0013,0073,0120,0017)
image&=create("hPic", -1,"ICON1.BMP")
create("BITMAP",lb1&,image&,260,0020)
Lb2&=create("text",%hwnd,"2",0,0,0,0)
image&=create("hPic", -1,"S2.BMP")
button2&=create("BITMAP", lb2&, image&, 0, 0)
SetWindowLong(BUTTON2&,-16,$5000010E | 256)
SetClassLong(Button2&,-12,hand&)
b1&    = create("RADIOButton",lb2&,"Check Me Seite 2 A",0013,0033,0120,0017)
b2&    = create("RADIOButton",lb2&,"Check Me Seite 2 B",0013,0053,0120,0017)
b3&    = create("RADIOButton",lb2&,"Check Me Seite 2 C",0013,0073,0120,0017)
image&=create("hPic", -1,"ICON2.BMP")
create("BITMAP",lb2&,image&,260,0020)
Lb3&=create("text",%hwnd,"3",0,0,0,0)
image&=create("hPic", -1,"S3.BMP")
button3&=create("BITMAP", lb3&, image&, 0, 0)
SetWindowLong(BUTTON3&,-16,$5000010E | 256)
SetClassLong(Button3&,-12,hand&)
c1&    = create("RADIOButton",lb3&,"Check Me Seite 3 A",0013,0033,0120,0017)
c2&    = create("RADIOButton",lb3&,"Check Me Seite 3 B",0013,0053,0120,0017)
c3&    = create("RADIOButton",lb3&,"Check Me Seite 3 C" ,0013,0073,0120,0017)
image&=create("hPic", -1,"ICON3.BMP")
create("BITMAP",lb3&,image&,260,0020)
clear a#
long a#,0=8
long a#,4=$FFFF'---Alles initialisieren
external("comctl32.dll","InitCommonControlsEx",a#)
'--Stil: $50000000 | ~CCS_NORESIZE | ~RBS_FIXEDORDER
ReBar&=Control("ReBarWindow32","",$50800885 ,10,10,300,400,%hwnd,2,$0200)
struct ReBar=Size&,Mask&,Style&,clrFore&,clrBack&,lpText&,cch&,iImage&,hwndChild&,\
cxMinChild&,cyMinChild&,cx&,hbmBack&,wID&,cyChild&,cyMaxChild&,cyIntegral&,\
cxIdeal&,lParam&,cxHeader&
dim ReBar#,ReBar'--REBARBANDINFO
clear ReBar#
with ReBar#
    .Size&=sizeof(ReBar#)
    .Mask&=$73'------RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE
    .cyMaxChild&=1'--Darf nicht Null sein
    .Style&=256'------------------------RBBS_GRIPPERALWAYS (folgende Bänder ohneGriff)
    .cxMinChild&=20'---------------------Minimum Breite
    .cyMinChild&=height(ReBar&)'--------Höhe des Bandes
    .cx&=100'---------------------------Vorgabe Breite
    .hwndChild&=Lb1&'-------------------Band 1
    sendmessage(ReBar&,1025,0,ReBar#)'--RB_INSERTBAND
    .Style&=256'------------------------RBBS_GRIPPERALWAYS (folgende Bänder ohne Griff)
    .cxMinChild&=20'--------------------Minimum Breite
    .cyMinChild&=height(ReBar&)'-------------------Höhe des Bandes
    .cx&=100'---------------------------Vorgabe Breite
    .hwndChild&=Lb2&'-------------------Band 2
    sendmessage(ReBar&,1025,1,ReBar#)'--RB_INSERTBAND
    .Style&=256'------------------------RBBS_GRIPPERALWAYS (folgende Bänder ohne Griff)
    .cxMinChild&=20'--------------------Minimum Breite
    .cyMinChild&=height(ReBar&)'-------------------Höhe des Bandes
    .cx&=100'---------------------------Vorgabe Breite
    .hwndChild&=Lb3&'-------------------Band 3
    sendmessage(ReBar&,1025,2,ReBar#)'--RB_INSERTBAND
endwith
while 1
    waitinput
    If &wparam = button1&
        sendmessage(ReBar&,1055,0,1)
    ElseIf &wparam = button2&
        sendmessage(ReBar&,1055,1,1)
    ElseIf &wparam = button3&
        sendmessage(ReBar&,1055,2,1)
    endif
endwhile
 | 
 |  |  |  |  |  |  |  |  |  |  | 
 
 
 | 
 Zum Quelltext| Themenoptionen | 7.024 Betrachtungen | 
 ThemeninformationenDieses Thema hat 2 Teilnehmer: |