Platforms to show: All Mac Windows Linux Cross-Platform
/Main/Web Edition Examples/WebApp with missing pictures Web1
Function:
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Main/Web Edition Examples/WebApp with missing pictures Web1
This example is the version from Thu, 30th Sep 2015.
Function:
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Main/Web Edition Examples/WebApp with missing pictures Web1
This example is the version from Thu, 30th Sep 2015.
Project "WebApp with missing pictures Web1.xojo_binary_project"
Class App Inherits WebApplication
End Class
Class Session Inherits WebSession
Const ErrorDialogCancel = "Do Not Send"
Const ErrorDialogMessage = "This application has encountered an error and cannot continue."
Const ErrorDialogQuestion = "Please describe what you were doing right before the error occurred:"
Const ErrorDialogSubmit = "Send"
Const ErrorThankYou = "Thank You"
Const ErrorThankYouMessage = "Your feedback helps us make improvements."
Const NoJavascriptInstructions = "To turn Javascript on, please refer to your browser settings window."
Const NoJavascriptMessage = "Javascript must be enabled to access this page."
End Class
Class WebPage1 Inherits WebPage
Control ImageView1 Inherits BetterImageView
ControlInstance ImageView1 Inherits BetterImageView
End Control
Control Label1 Inherits WebLabel
ControlInstance Label1 Inherits WebLabel
End Control
Control ImageView2 Inherits BetterImageView
ControlInstance ImageView2 Inherits BetterImageView
End Control
Control ImageView3 Inherits BetterImageView
ControlInstance ImageView3 Inherits BetterImageView
End Control
Control Label2 Inherits WebLabel
ControlInstance Label2 Inherits WebLabel
End Control
End Class
Class BetterImageView Inherits WebImageView
EventHandler Sub Open()
if ErrorImages = nil then
ErrorImages = new Dictionary
end if
dim key as string = str(me.Width)+"x"+str(me.Height)
// check to see if we got one already for this size
if not ErrorImages.HasKey(key) then
dim p as new Picture(me.Width, me.Height, 32)
dim g as Graphics = p.Graphics
g.TextSize = 12
dim s as string = "Missing Picture"
dim w as integer = g.stringWidth(s)
dim h as integer = g.TextHeight
g.TextFont = "Helvetica"
g.drawstring s, (g.Width-w)/2, (g.Height-h)/2
ErrorImage = new WebPicture(p)
ErrorImages.Value(key) = ErrorImage
else
ErrorImage = ErrorImages.Value(key)
end if
End EventHandler
EventHandler Sub Shown()
dim w as string = str(me.Width)
dim h as string = str(me.height)
dim o as string = "document.getElementById('"+me.ControlID+"_image')"
// set width/height to the one of the control.
me.ExecuteJavaScript o+".width = '"+w+"px';"
me.ExecuteJavaScript o+".height = '"+h+"px';"
me.ExecuteJavaScript o+".style.width = '"+w+"px';"
me.ExecuteJavaScript o+".style.height = '"+h+"px';"
me.ExecuteJavaScript o+".style.marginLeft = '0px';"
me.ExecuteJavaScript o+".style.marginTop = '0px';"
me.ExecuteJavaScript o+".style.top = '0px';"
me.ExecuteJavaScript o+".style.left = '0px';"
// set on error event, so we replace image with error image in case of load error
me.ExecuteJavaScript o+".onerror=function(){ this.src='"+me.ErrorImage.URL+"' };"
End EventHandler
Property ErrorImage As WebPicture
Property Shared ErrorImages As Dictionary
End Class
End Project
See also:
- /Main/Web Edition Examples/Infos Web1
- /Main/Web Edition Examples/Infos Web2
- /Main/Web Edition Examples/Invisible FileUploader with Button Web1
- /Main/Web Edition Examples/Little database sample Web1
- /Main/Web Edition Examples/Music in Web App Web1
- /Main/Web Edition Examples/TicTacToe game/TicTacToe game Web1
- /Main/Web Edition Examples/TicTacToe game/TicTacToe game Web2
- /Main/Web Loadbalancer Example/MyApp
The items on this page are in the following plugins: MBS Main Plugin.
Feedback: Report problem or ask question.