« Booked my trip to Atl… | Home | Omege Bundle for REAL… »

Inside REAL Studio Web Edition

Today I did some heavy web development with the REAL Studio Web Edition. And I got a few curious things. I think this are internal variables, but they look interesting. So have you tried adding a variable "port as integer" to your App object in the Web Edition? Guess what happens?
Well, your port variable is there. No error, but suddenly you can't launch your app! Seems like port is a variable already declared by REAL Studio. Your own property hides the one from the framework and suddenly it uses port=0 for the sockets. A simple
print str(app.port)
shows the port from the build settings. Port does not autocomplete, but it is listed in the documentation, so this is not a hidden thing. On the documentation you see also an icon property. But it's not in the current REAL Studio WebApplication class, at least not in REAL Studio 2010r5.
So it's somewhere else and I found it. If you are in app.open, the word framework does not autocomplete, but once you wrote it for any reason, it shows "WebApplication.framework as Dictionary" in the status line. This dictionary is very interesting. To look inside, simply write in a app.open event
Sub Open()
dim d as dictionary = framework
break
End Sub
Once in the debugger, you can see the content of d. The dictionary has the following keys and values:
  • framework.css, some Style Sheets
  • framework.js, some javascript
  • pagestop.png, a PNG with forbidden sign. You see it if the connection is lost.
  • space.gif, a GIF.
  • favicon.ico, the favorite icon which Safari shows next to the URL. Currently a globe picture.
Now we can use that and replace the pagestop png with our own like this:
Sub Open()
// take a picture
dim p as picture = logoMBS(500)
// make a PNG
dim s as string = PictureToPNGStringMBS(p,0)
// assign to the framework dictionary
framework.Value("pagestop.png") = s
End Sub
I don't know how REAL Software sees this, but I like this dictionary. It allows us to customize a few things like the favorite icon and the pagestop icon. They could simply document it and have users pass their own items here. Maybe that's their intent as normally they hide properties used by the framework. Sometimes you see those internal properties in the debugger or in autocomplete. They start with underscores and should be invisible for autocomplete or the debugger. By the way: Documenting this dictionary would implement a few feature requests right away.

PS: Years ago I read this Inside Turbo Pascal books to learn how things worked and I think this should exist for REAL Studio, too. The biggest plugin in space...
11 01 11 - 17:20