Can anyone tell me what is wrong with this code:
Code: Select all
PanelGadget(1000, 0, 170, 600, 270)
For c = 1 To ObjNumber
; do something
AddGadgetItem(1000, -1, c)
CloseGadgetList()
Next
Cecil

Code: Select all
PanelGadget(1000, 0, 170, 600, 270)
For c = 1 To ObjNumber
; do something
AddGadgetItem(1000, -1, c)
CloseGadgetList()
Next
Code: Select all
PanelGadget(1000, 0, 170, 600, 270)
For c = 1 To ObjNumber
AddGadgetItem(1000, -1, c)
Next
CloseGadgetList()

Code: Select all
PanelGadget(1000, 0, 170, 600, 270)
For c = 1 To ObjNumber
AddGadgetItem(1000, -1, "Object" + c)
TextGadget(#Text_2 + (c), 8, 13, 50, 15, "Position")
SetGadgetFont(#Text_2 + (c), FontID6)
TextGadget(#Text_3 + (c), 68, 13, 10, 15, "X")
SetGadgetFont(#Text_3 + (c), FontID6)
StringGadget(#PosX_ + (c), 83, 13, 65, 20, "")
SetGadgetFont(#PosX_ + (c), FontID4)
SetGadgetText(#PosX_ + (c), Str(XPos) )
Next
CloseGadgetList()
Code: Select all
#Text_2=10
#Text_3=20
#PosX_=30
ObjNumber=3
If OpenWindow(0,0,0,600,480,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"")
If CreateGadgetList(WindowID(0))
PanelGadget(1000, 0, 170, 600, 270)
For c = 1 To ObjNumber
AddGadgetItem(1000, -1, "Object" + Str(c))
TextGadget(#Text_2 + c, 8, 13, 60, 15, "Position")
SetGadgetFont(#Text_2 + c, FontID6)
TextGadget(#Text_3 + c, 68, 13, 10, 15, "X")
SetGadgetFont(#Text_3 + c, FontID6)
StringGadget(#PosX_ + c, 83, 13, 65, 20, "")
SetGadgetFont(#PosX_ + c, FontID4)
SetGadgetText(#PosX_ + c, Str(XPos) )
Next
CloseGadgetList()
EndIf
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf

Code: Select all
Structure ToolbookObj
Obj.s
EndStructure
Structure Toolbook_ObjectProp Extends ToolbookObj
XPos.l
YPos.l
Breit.l
Hohe.l
FillColor.s
TextColor.s
Txt.s
BorderStyle.s
ScriftArt.s
SchriftGross.l
SchriftStil.s
TBKObjekt.s
TBKObjektID.l
TBKTextAlign.s
TBKLayer.l
HTMLStyle.s
HTMLObj.s
EndStructure
Dim TBK.Toolbook_ObjectProp(100)
If OpenWindow(20, 282, 124, 600, 452, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "HTML Transfer")
If CreateGadgetList(WindowID())
TextGadget(0, 10, 10, 150, 20, "HTML Transfer")
SetGadgetFont(0, FontID3)
TextGadget(1, 10, 40, 100, 20, "Transferring...")
SetGadgetFont(1, FontID4)
ListViewGadget(10, 0, 60, 600, 50)
SetGadgetFont(10, FontID5)
AddGadgetItem(10, -1, "Initialising HTML Transfer...")
SetGadgetState(10, CountGadgetItems(10)-1)
Delay(150)
AddGadgetItem(10, -1, "Reading data from Toolbook...")
SetGadgetState(10, CountGadgetItems(10)-1)
If ReadFile(1,"temp.txt")
While Eof(1)=0
If Parameter$
Parameter$ = Parameter$ + Chr(13) + ReadString() ; "
Else
Parameter$ = ReadString()
EndIf
Wend ; "
CloseFile(1)
Else
MessageRequester("HTML Transfer","Error in reading file",0)
EndIf
ObjNumber = CountString(Parameter$, "|") + 1
AddGadgetItem(10, -1, "Start to transfer Toolbook Objects...")
SetGadgetState(10, CountGadgetItems(10)-1)
For c = 1 To ObjNumber
TBK(c)\Obj = StringField(Parameter$,c,"|")
TBK(c)\XPos = Val(StringField(TBK(c)\Obj,1,"§"))
TBK(c)\YPos = Val(StringField(TBK(c)\Obj,2,"§"))
TBK(c)\Breit = Val(StringField(TBK(c)\Obj,3,"§"))
TBK(c)\Hohe = Val(StringField(TBK(c)\Obj,4,"§"))
TBK(c)\FillColor = "#" + Hex1(Val(StringField(StringField(TBK(c)\Obj,5,"§"),1,","))) + Hex1(Val(StringField(StringField(TBK(c)\Obj,5,"§"),2,","))) + Hex1(Val(StringField(StringField(TBK(c)\Obj,5,"§"),3,",")))
TBK(c)\TextColor = "#" + Hex1(Val(StringField(StringField(TBK(c)\Obj,6,"§"),1,","))) + Hex1(Val(StringField(StringField(TBK(c)\Obj,6,"§"),2,","))) + Hex1(Val(StringField(StringField(TBK(c)\Obj,6,"§"),3,",")))
TBK(c)\Txt = ReplaceString(StringField(TBK(c)\Obj,7,"§"),Chr(13),"<br/>")
TBK(c)\BorderStyle = StringField(TBK(c)\Obj,8,"§")
TBK(c)\ScriftArt = StringField(TBK(c)\Obj,9,"§")
TBK(c)\SchriftGross = Val(StringField(TBK(c)\Obj,10,"§"))
TBK(c)\SchriftStil = StringField(TBK(c)\Obj,11,"§")
If TBK(c)\SchriftStil = "bold"
TBK(c)\SchriftStil = "font-weight: bold;"
Else
If TBK(c)\SchriftStil = "italic"
TBK(c)\SchriftStil = "font-style: italic;"
Else
If TBK(c)\SchriftStil = "bold,italic"
TBK(c)\SchriftStil = "font-style: italic; font-weight: bold;"
Else
TBK(c)\SchriftStil = "font-style: normal;"
EndIf
EndIf
EndIf
TBK(c)\TBKObjekt = StringField(TBK(c)\Obj,12,"§")
TBK(c)\TBKObjektID = Val(StringField(TBK(c)\Obj,13,"§"))
AddGadgetItem(10, -1, "Transfering " + TBK(c)\TBKObjekt + " ID Number " + Str(TBK(c)\TBKObjektID) + " ...")
SetGadgetState(10, CountGadgetItems(10)-1)
TBK(c)\TBKTextAlign = StringField(TBK(c)\Obj,14,"§")
TBK(c)\TBKLayer = Val(StringField(TBK(c)\Obj,15,"§"))
TBK(c)\HTMLStyle = ".Style" + StrU(c,#Long) + " { position: absolute; left: " + Str(TBK(c)\XPos) + "px; top: " + Str(TBK(c)\YPos) + "px; height: " + Str(TBK(c)\Hohe) + "px; width: " + Str(TBK(c)\Breit) + "px; text-align :" + TBK(c)\TBKTextAlign + "; font-family: " + TBK(c)\ScriftArt + "; font-size: " + StrU(TBK(c)\SchriftGross,#Long) + "pt; " + TBK(c)\SchriftStil + " color: " + TBK(c)\TextColor + "; z-index: " + Str(TBK(c)\TBKLayer) + ";"
If TBK(c)\TBKObjekt = "Field"
; MessageRequester("HTML Transfer", TBK(c)\BorderStyle , #PB_MessageRequester_Ok)
Select TBK(c)\BorderStyle
Case "rectangle"
TBK(c)\HTMLStyle = TBK(c)\HTMLStyle + " border-style: solid; border-width: thin;}"
Default
TBK(c)\HTMLStyle = TBK(c)\HTMLStyle + "}"
EndSelect
Else
TBK(c)\HTMLStyle = TBK(c)\HTMLStyle + "}"
EndIf
If TBK(c)\TBKObjekt = "Button"
; TBK(c)\HTMLObj = "<Input class = " + Chr(34) + "Style" + StrU(c,#Long) + Chr(34) + " type = " + Chr(34) + "Submit" + Chr(34) + " name = " + Chr(34) + TBK(c)\Txt + Chr(34) + " value = " + Chr(34) + TBK(c)\Txt + Chr(34) + ">"
TBK(c)\HTMLObj = "<Button class = " + Chr(34) + "Style" + StrU(c,#Long) + Chr(34) + " type = " + Chr(34) + "Button" + Chr(34) + " name = " + Chr(34) + TBK(c)\Txt + Chr(34) + " value = " + Chr(34) + TBK(c)\Txt + Chr(34) + ">" + TBK(c)\Txt + "</button>"
Else
If TBK(c)\TBKObjekt = "Field" And TBK(c)\BorderStyle = "inset"
TBK(c)\HTMLObj = "<Input class = " + Chr(34) + "Style" + StrU(c,#Long) + Chr(34) + " type = " + Chr(34) + "text" + Chr(34) + " name = " + Chr(34) + "textField" + Str(c) + Chr(34) + " value = " + Chr(34) + TBK(c)\Txt + Chr(34) + " size = " + Chr(34) + Str(TBK(c)\Breit) + Chr(34) + "/>"
; TBK(c)\HTMLObj = "<Div class = " + Chr(34) + "Style" + StrU(c,#Long) + Chr(34) + "</div>" + TBK(c)\Txt + "</div>"
Else
TBK(c)\HTMLObj = "<Div class = " + Chr(34) + "Style" + StrU(c,#Long) + Chr(34) + "</div>" + TBK(c)\Txt + "</div>"
EndIf
EndIf
Next
PanelGadget(1000, 0, 170, 600, 270)
For c = 1 To ObjNumber
AddGadgetItem(1000, -1, "Object" + Str(c))
TextGadget(#Text_2 + c, 8, 13, 60, 15, "Position")
SetGadgetFont(#Text_2 + c, FontID6)
TextGadget(#Text_3 + c, 68, 13, 10, 15, "X")
SetGadgetFont(#Text_3 + c, FontID6)
StringGadget(#PosX_ + c, 83, 13, 65, 20, "")
SetGadgetFont(#PosX_ + c, FontID4)
SetGadgetText(#PosX_ + c, Str(XPos) )
Next
CloseGadgetList()
Delay(1)
EndIf
AddGadgetItem(10, -1, "Writing HTML File...")
SetGadgetState(10, CountGadgetItems(10)-1)
; (more code follows)

Code: Select all
#Text_2=10
#Text_3=20
#PosX_=30
ObjNumber=23
If OpenWindow(0,0,0,600,480,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"")
If CreateGadgetList(WindowID(0))
PanelGadget(1000, 0, 170, 600, 270)
For c = 1 To ObjNumber
AddGadgetItem(1000, -1, "Object" + Str(c))
TextGadget(#Text_2 + c, 8, 13, 60, 15, "Position")
SetGadgetFont(#Text_2 + c, FontID6)
TextGadget(#Text_3 + c, 68, 13, 10, 15, "X")
SetGadgetFont(#Text_3 + c, FontID6)
StringGadget(#PosX_ + c, 83, 13, 65, 20, "")
SetGadgetFont(#PosX_ + c, FontID4)
SetGadgetText(#PosX_ + c, Str(XPos) )
Next
CloseGadgetList()
EndIf
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf

It's in the code already posted in this thread!cecilcheah wrote:What offset are we talking about? Can you give me an example code.
Code: Select all
#Text_2=10
#Text_3=20
#PosX_=30
Code: Select all
#Gadget=0 ;we will start our gadget count at 0
#offset=3 ;each tab has 3 gadgets so the offset is 3
ObjNumber=10 * #offset ;in this example we want 10 tabs
If OpenWindow(0,0,0,600,480,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"")
If CreateGadgetList(WindowID(0))
PanelGadget(1000, 0, 170, 600, 270)
For c = 1 To ObjNumber Step #offset
AddGadgetItem(1000, -1, "Object" + Str(c/#offset))
TextGadget(#Gadget+c, 8, 13, 60, 15, "Position") ;1st gadget in tab
SetGadgetFont(#Gadget+c, FontID6)
TextGadget(#Gadget+1+c, 68, 13, 10, 15, "X") ;2nd gadget in tab
SetGadgetFont(#Gadget+1+c, FontID6)
StringGadget(#Gadget+2+c, 83, 13, 65, 20, "") ;3rd gadget in tab
SetGadgetFont(#Gadget+2+c, FontID4)
SetGadgetText(#Gadget+2+c, Str(XPos) )
Next
CloseGadgetList()
EndIf
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf

Is there a way to have the Garget Number > 10000#Gadget object number is very high (over 10000), are You sure of that?

Code: Select all
Enumeration
#Text_0
#Text_1
#Listview_0
#Button_0
#Panel_0
#Gadget = 100
#PosX_ = 3000
#PosY_ = 3500
#Breit_ = 4000
#Hohe_ = 4500
#SchriftArt_ = 5000
#SchriftGross_ = 5500
#SchriftStil_ = 6000
#SchriftFarbe_ = 6500
#Farbe_ = 7000
#RandStil_ = 7500
#Texte_ = 8000
#Sicht_ = 8500
#Alignment_ = 9000
#offset=16
EndEnumeration
Code: Select all
For c = #offset To ObjNumber * #offset Step #offset
AddGadgetItem(#Panel_0, -1, TBK(c/#offset)\TBKObjekt + " ID Number " + Str(TBK(c/#offset)\TBKObjektID))
TextGadget(#Gadget + c, 8, 13, 50, 15, "Position")
SetGadgetFont(#Gadget + c, FontID6)
TextGadget(#Gadget+1 + c, 68, 13, 10, 15, "X")
SetGadgetFont(#Gadget+1 + c, FontID6)
StringGadget(#PosX_ + c/#offset, 83, 13, 65, 20, "")
SetGadgetFont(#PosX_ + c/#offset, FontID4)
SetGadgetText(#PosX_ + c/#offset,Str(TBK(c/#offset)\XPos))
TextGadget(#Gadget+2 + c, 158, 13, 15, 15, "Y")
SetGadgetFont(#Gadget+2 + c, FontID6)
StringGadget(#PosY_ + c/#offset, 178, 13, 65, 20, "")
SetGadgetFont(#PosY_ + c/#offset, FontID4)
SetGadgetText(#PosY_ + c/#offset,Str(TBK(c/#offset)\YPos))
TextGadget(#Gadget+3 + c, 263, 13, 35, 20, "Size")
SetGadgetFont(#Gadget+3 + c, FontID6)
TextGadget(#Gadget+4 + c, 303, 13, 40, 15, "Width")
SetGadgetFont(#Gadget+4 + c, FontID6)
StringGadget(#Breit_ + c/#offset, 348, 13, 45, 20, "")
SetGadgetFont(#Breit_ + c/#offset, FontID4)
SetGadgetText(#Breit_ + c/#offset,Str(TBK(c/#offset)\Breit))
TextGadget(#Gadget+5 + c, 398, 13, 40, 15, "Height")
SetGadgetFont(#Gadget+5 + c, FontID6)
StringGadget(#Hohe_ + c/#offset, 453, 13, 45, 20, "")
SetGadgetFont(#Hohe_ + c/#offset, FontID4)
SetGadgetText(#Hohe_ + c/#offset,Str(TBK(c/#offset)\Hohe))
TextGadget(#Gadget+6 + c, 8, 38, 35, 20, "Font")
SetGadgetFont(#Gadget+6 + c, FontID6)
TextGadget(#Gadget+7 + c, 58, 38, 35, 15, "Name")
SetGadgetFont(#Gadget+7 + c, FontID6)
TextGadget(#Gadget+8 + c, 213, 38, 30, 15, "Size")
SetGadgetFont(#Gadget+8 + c, FontID6)
TextGadget(#Gadget+9 + c, 308, 38, 30, 15, "Style")
SetGadgetFont(#Gadget+9 + c, FontID6)
StringGadget(#SchriftArt_ + c/#offset, 98, 38, 105, 20, "")
SetGadgetFont(#SchriftArt_ + c/#offset, FontID4)
SetGadgetText(#SchriftArt_ + c/#offset,TBK(c/#offset)\ScriftArt)
StringGadget(#SchriftGross_ + c/#offset, 248, 38, 50, 20, "")
SetGadgetFont(#SchriftGross_ + c/#offset, FontID4)
SetGadgetText(#SchriftGross_ + c/#offset,Str(TBK(c/#offset)\SchriftGross))
StringGadget(#SchriftStil_ + c/#offset, 353, 38, 85, 20, "")
SetGadgetFont(#SchriftStil_ + c/#offset, FontID4)
SetGadgetText(#SchriftStil_ + c/#offset,TBK(c/#offset)\SchriftStil)
TextGadget(#Gadget+10 + c, 153, 63, 40, 15, "Stroke")
SetGadgetFont(#Gadget+10 + c, FontID6)
StringGadget(#SchriftFarbe_ + c/#offset, 198, 63, 70, 20, "")
SetGadgetFont(#SchriftFarbe_ + c/#offset, FontID4)
SetGadgetText(#SchriftFarbe_ + c/#offset,TBK(c/#offset)\TextColor)
TextGadget(#Gadget+11 + c, 8, 63, 40, 15, "Color")
SetGadgetFont(#Gadget+11 + c, FontID6)
StringGadget(#Farbe_ + c/#offset, 78, 63, 65, 20, "")
SetGadgetFont(#Farbe_ + c/#offset, FontID4)
SetGadgetText(#Farbe_ + c/#offset,TBK(c/#offset)\FillColor)
TextGadget(#Gadget+12 + c, 58, 63, 20, 15, "Fill")
SetGadgetFont(#Gadget+12 + c, FontID6)
TextGadget(#Gadget+13 + c, 278, 63, 80, 15, "Border Style")
SetGadgetFont(#Gadget+13 + c, FontID6)
StringGadget(#RandStil_ + c/#offset, 363, 63, 80, 20, "")
SetGadgetFont(#RandStil_ + c/#offset, FontID4)
SetGadgetText(#RandStil_ + c/#offset,TBK(c/#offset)\BorderStyle)
TextGadget(#Gadget+14 + c, 8, 93, 35, 15, "Text")
SetGadgetFont(#Gadget+14 + c, FontID6)
StringGadget(#Texte_ + c/#offset, 53, 88, 535, 135, "")
SetGadgetFont(#Texte_ + c/#offset, FontID4)
SetGadgetText(#Texte_ + c/#offset,TBK(c/#offset)\Txt)
TextGadget(#Gadget+15 + c, 453, 38, 40, 15, "Layer")
SetGadgetFont(#Gadget+15 + c, FontID6)
TextGadget(#Gadget+16 + c, 453, 63, 35, 20, "Align")
SetGadgetFont(#Gadget+16 + c, FontID6)
StringGadget(#Sicht_ + c/#offset, 498, 38, 40, 20, "")
SetGadgetFont(#Sicht_ + c/#offset, FontID4)
SetGadgetText(#Sicht_ + c/#offset,Str(TBK(c/#offset)\TBKLayer))
StringGadget(#Alignment_ + c/#offset, 498, 63, 80, 20, "")
SetGadgetFont(#Alignment_ + c/#offset, FontID4)
SetGadgetText(#Alignment_ + c/#offset,TBK(c/#offset)\TBKTextAlign)
Next
CloseGadgetList()
Code: Select all
#Panel=0
#Gadget=1 ;we will start our gadget count at 0
#offset=3 ;each tab has 3 gadgets so the offset is 3
ObjNumber=500 * #offset ;in this example we want 10 tabs
If OpenWindow(0,0,0,600,480,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"")
If CreateGadgetList(WindowID(0))
PanelGadget(#Panel, 0, 170, 600, 270)
For c = 1 To ObjNumber Step #offset
AddGadgetItem(0, -1, "Object" + Str(c/#offset))
TextGadget(#Gadget+c, 8, 13, 60, 15, "Position") ;1st gadget in tab
SetGadgetFont(#Gadget+c, FontID6)
TextGadget(#Gadget+1+c, 68, 13, 10, 15, "X") ;2nd gadget in tab
SetGadgetFont(#Gadget+1+c, FontID6)
StringGadget(#Gadget+2+c, 83, 13, 65, 20, "") ;3rd gadget in tab
SetGadgetFont(#Gadget+2+c, FontID4)
SetGadgetText(#Gadget+2+c, Str(#Gadget+2+c) )
Next
CloseGadgetList()
EndIf
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf