Ein paar Fehler beim Neuladen beseitigt.
$H Windows.ph
$H messages.ph
$H commctrl.ph
Declare Lv#,a$,b$,Bi$,Bi%,bm&,E%,F$,F&,F%,H%,hx!,IL%,L%,Lx%,MA&,O$,x%,x&,y%,y&,z&,C%,P%
struct Lv=Ma&,It&,SI&,St&,SM&,Te&,TM&,Im&
dim Lv#,Lv
Windowtitle "Bildbetrachter für JPG - PNG - BMP - GIF"
Window 900,640
Cls RGB(0,90,180)
F&=CreateFont("Verdana",16,0,0,0,0)
SetDialogFont F&
H%=%hWnd
AppendMenuBar 109,"Beenden"
AppendMenuBar 101,"Ordner öffnen"
AppendMenuBar 110,"Beschreibung Öffnen"
AppendMenuBar 111,"Beschreibung speichern"
AppendMenuBar 102,"Bild min."
AppendMenuBar 103,"Bild max."
DTEX "Bitte einen Ordner öffnen",4
SUBCLASS H%,1
userMessages 16
AddHotKey 99,13,0
while 1
Lx%=Width(L%)
Waitinput
Case MenuItem(109) | (%umessage=16):BREAK
case MenuItem(101):BS
If Getfocus(L%)
x%=GetCurSel(L%)
If (x%>-1)
Bi$=O$+"\"+GetText$(L%,x%,0)
Bi%=x%
HTM
If %MouseKey=2
a$=GetText$(L%,x%,1)
E%=CreateEdit(H%,a$,10,Height(MA&)+50,Width(MA&),22)
setfocus(E%): SendString(E%,"+({END})")
While getfocus(E%)
Waitinput
Case MenuItem(99):BREAK
Wend
settext L%,x%,1,gettext$(E%)
DestroyWindow(E%)
EndIf
EndIf
DTEX Gettext$(L%,x%,0)+" : "+Gettext$(L%,x%,1),4
Setfocus(H%)
ElseIf MenuItem(102)
F%=1
HTM
ElseIf MenuItem(103)
F%=0
HTM
ElseIf MenuItem(110) AND (O$<>"")
F$=LoadFile$("Lade ein Bild","*.csv")
case F$<>""
FT
Setfocus(H%)
ElseIf MenuItem(111) AND (O$<>"")
a$=@SaveFile$("Speichern","Text (*.csv)|*.csv")
If a$<>""
Assign #1,a$
Rewrite #1
whileloop 0,GetCount(L%)-1
Print #1,Gettext$(L%,&loop,0)+";"+Gettext$(L%,&loop,1)
wend
Close #1
EndIf
ElseIf Lx%<>Width(L%)
hx!=Width(H%)-Width(L%)-70
HTM
EndIf
EndWhile
DeleteObject IL%
DeleteObject bm&
END
SubClassproc
IF SUBCLASSMESSAGE(H%,~WM_SIZING) or SUBCLASSMESSAGE(H%,~WM_SIZE)
SETWINDOWPOS L%=Width(H%)-Lx%-10,40 - Lx%,Height(H%)-50
hx!=Width(H%)-Lx%-70
HTM
SETWINDOWPOS E%=10,(Height(MA&)+50) - Width(MA&),22
SET("WinProc",0)
EndIf
endproc
Proc FT
b$=""
whileloop 0,GetCount(L%)-1
If GetState(L%,&loop)>0
b$=Gettext$(L%,&loop,0)
BREAK
EndIf
wend
Assign #1,F$
Reset #1
WhileNot EOF(#1)
Input #1,a$
x%=SelectString(L%,-1,substr$(a$,1,";"))
case x%>0:SetText L%,x%,1,substr$(a$,-1,";")
EndWhile
Close #1
SelectString(L%,-1,b$)
EndProc
Proc BS
a$=O$
O$=ChooseDir$("Verzeichnis:")
ChDir O$
ClearList
AddFiles "*.png"
AddFiles "*.jpg"
AddFiles "*.bmp"
AddFiles "*.gif"
If (O$="") OR GetCount(0)=0
MessageBox("Ordner\n"+O$+"\nenthält keine Bilder","Hinweis",64)
O$=a$
Return
EndIf
DestroyWindow(IL%)
DestroyWindow(L%)
DestroyWindow(MA&)
DTEX "Bitte warten, Bilder werden geladen."
IL%=create("ImageList",80,60)
Var Lb%=Create("ListBox",H%,1,0,0,0,0)
Whileloop 0,GetCount(0)-1
AddString(Lb%,ListBoxItem$(&loop))
EndWhile
L%=create("gridbox",H%,"Bild;0;220;Beschreibung;0;220",0,Width(H%)-480,40,470,Height(H%)-50)
hx!=Width(H%)-530
F%=1
Create("Tooltip",H%,L%,"Edit: R-Klick\nÜbernahme: no Focus/Enter")
sendmessage(L%,~LVM_SETIMAGELIST,~LVSIL_SMALL,IL%)
~SetWindowLong(L%,~GWL_EXSTYLE,0)
SetStyle L%,GetStyle(L%) | ~ws_thickFrame
Whileloop 0,GetCount(Lb%)-1
bm&=Create("hSizedPic",-1,GetString$(Lb%,&loop),80,60,0)
ImageList("Add",IL%,bm&)
AddString(L%,GetString$(Lb%,&loop))
SetI(L%,GetCount(L%)-1,0,GetCount(IL%)-1)
Wend
Bi%=0
setcursel L%,0
DTEX Gettext$(L%,0,0)+" : "+Gettext$(L%,0,1),4
Bi$=O$+"\"+Gettext$(L%,0,0)
HTM
EndProc
Proc HTM
DestroyWindow(MA&)
a$="mshtml:"
If F%=1'
a$=a$+"<p align="center"><img src='"+Bi$+"' height='"+str$(int(hx!*0.58))+"' /></p>"
MA&=@create("htmlWin",H%,a$,6,10,40,hx!+10,hx!*0.58+30)
Else
a$=a$+"<p align="center"><img src='"+Bi$+"' /></p>"
MA&=@create("htmlWin",H%,a$,5,10,40,hx!+10,Height(H%)-82)
EndIf
EndProc
Proc DTEX
Parameters dt$,dty%
MCls Width(H%), 30 ,rgb(0,90,180)
StartPaint -1
TextColor @RGB(255,255,255),-1
UseFont "Verdana",20,0,0,0,0
DrawText 10,6,dt$
EndPaint -1
bm&=@Create("hPic",0,"&MEMBMP")
DrawPic bm&,10,dty%; 0
EndProc
proc SetI
Lv#.It&=&(2)
Lv#.SI&=&(3)
Lv#.Ma&=~LVIF_IMAGE
Lv#.Im&=%(4)
sendmessage(&(1),~LVM_SETITEM,0,Lv#)
endproc
Alles anzeigen