What about a PureBasic Markup Language : PBML ?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

What about a PureBasic Markup Language : PBML ?

Post by Flype »

I'm wondering how useful could be a PureBasic XML language for describing/making GUI.

So, here is an archive that shows what could be done with PBML.
It contains an exe (sort of player) and a PBML description file (the GUI) and some images.
The PBML file is loaded at the start of the application. You can modify it, play a little with it.

It is a totally experimental stuff using my PureXML beta-userlib.

Download: PBML_TEST.zip

I think such concept can be included in Visual Designer or in PureForm.
Two modes could be used. One for loading dynamically the GUI, the other for compiling PBML into PureBasic native code...


Here is an example of a PBML file :

Code: Select all

<?xml version="1.0" ?>
<!-- PBML, PureBasic Markup Language -->
<pbml>
	
	<header>
		<title>A small PBML example</title>
		<version>1</version>
		<revision>0</revision>
		<author>flype</author>
		<date>2007-01-21</date>
	</header>
	
	<image id='0' filename='image0.ico' />
	<image id='1' filename='image1.ico' />
	<image id='2' filename='image2.ico' />
	<image id='3' filename='image3.ico' />
	<image id='4' filename='image4.bmp' />
	
	<font id='0' name='Arial' size='8' />
	<font id='1' name='Arial' size='8' flags='Bold,Underline' />
	<font id='2' name='Arial' size='14' flags='Bold' />
	
	<window id='0' width='640' height='480' text='PBML' image='4' color='E0E0E0' flags='MinimizeGadget,MaximizeGadget,SystemMenu,SizeGadget,ScreenCentered'>
		
		<shortcut window='' type='Escape' event='5' />
		
		<statusbar id='0' window='0'>
			<item width='100' text='StatusBar 0' flags='Raised,Right' />
			<item width='150' text='StatusBar 1' flags='Raised,Center' />
			<item width='200' text='StatusBar 2' flags='Raised,BorderLess' />
		</statusbar>
		
		<toolbar id='0' window='0'>
			<item id='0' type='standard' href='0' mode='normal' tooltip='toolbar item 0' />
			<item id='1' type='standard' href='1' mode='toggle' tooltip='toolbar item 1' />
			<item id='2' type='standard' href='2' mode='toggle' tooltip='toolbar item 2' />
			<separator />
			<item id='3' type='image' href='0' mode='normal' tooltip='toolbar item 3' />
			<item id='4' type='image' href='1' mode='normal' tooltip='toolbar item 4' />
			<item id='5' type='image' href='2' mode='normal' tooltip='toolbar item 5' />
			<item id='6' type='image' href='3' mode='normal' tooltip='toolbar item 6' />
		</toolbar>
		
		<standardmenu id='0' window='0'>
			<menu text='Project'>
				<item id='1' text='Open' shortcut='Ctrl+O' checked='0' unchecked='1' />
				<item id='2' text='Save' shortcut='Ctrl+S' />
				<separator />
				<submenu text='Information'>
					<item id='3' text='Help' shortcut='F1' />
					<separator />
					<item id='4' text='About' />
				</submenu>
				<separator />
				<item id='5' text='Exit' shortcut='Escape' />
			</menu>
			<menu text='Help'>
				<item id='6' text='Help' shortcut='F1' />
				<separator />
				<item id='7' text='About' />
			</menu>
		</standardmenu>
		
		<gadget window='0'>
			<panel id='0' left='10' top='40' width='620' height='350' color='CCFFFF' tooltip='panel 0'>
				<item text='Panel1'>
					<container id='1' left='10' top='40' width='310' height='150' color='CCFFCC' flags='Double' tooltip='container 0'>
						<button id='2' left='10' top='40' width='200' height='30' text='Hello World !' flags='Right' font='1' tooltip='button 0' />
						<button id='3' left='10' top='80' width='200' height='30' text='PureBasic Rulez !!!' flags='Left,Toggle' font='2' tooltip='button 1' />
					</container>
				</item>
				<item text='Panel2'>
					<container id='7' left='30' top='50' width='310' height='200' color='FFCCCC' flags='Single' tooltip='container 0'>
						<button id='4' left='10' top='40' width='200' height='30' text='Hello World !' flags='Right' font='0' tooltip='button 0' />
						<button id='5' left='10' top='80' width='200' height='30' text='PureBasic Rulez !!!' flags='Left,Toggle' font='1' tooltip='button 1' />
					</container>
				</item>
			</panel>
			<button id='6' left='10' top='400' width='100' height='30' text='Exit' flags='Default' tooltip='Exit the demo' />
		</gadget>
		
	</window>
	
	<systray window='0' image='0' tooltip='PBML Demo' />
	
</pbml>
and PBML sounds good i think.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
User avatar
flaith
Enthusiast
Enthusiast
Posts: 704
Joined: Mon Apr 25, 2005 9:28 pm
Location: $300:20 58 FC 60 - Rennes
Contact:

Post by flaith »

really impressive and it's a good idea !
“Fear is a reaction. Courage is a decision.” - WC
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

Very good idea!!

Once i played with this same idea when trying to store and read at runtime the description of a GUI of my program.

I guess its the future and that MANY things can be done by this way.
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

Reminds me of XAML.

Interesting for sure.
Intrigued - Registered PureBasic, lifetime updates user
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post by KarLKoX »

Great idea for a great feature ! This is really a plus for PB :)
Merkik ;)
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Good idea, indeed.
1. I assume 'Id' is the gadget number ? How would you implement #PB_Any ?
2. Could you document your 'rules of translation' for each gadget / window / etc.., like ButtonGadget(id, left, top, width, height, text [, flags]) ==> <button id='' left='' top='' width='' height='' text='' flags='' />
3. I think the gadget classes / flags / etc .. should be named exactly as they are in PB, e.g. ButtonGadget (and not button) or PB_Button_Toggle (and not Toggle)
Last edited by gnozal on Fri Jan 26, 2007 10:02 am, edited 1 time in total.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
JCV
Enthusiast
Enthusiast
Posts: 580
Joined: Fri Jun 30, 2006 4:30 pm
Location: Philippines

Post by JCV »

nice. It can do many possibilities.
Yahoo Messenger uses something like that for its themes and also with others. :D
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

gnozal wrote:Good idea, indeed.
1. I assume 'Id' is the gadget number ? How would you implement #PB_Any ?
2. Could you document your 'rules of translation' for each gadget / window / etc.., like ButtonGadget(id, left, top, width, height, text [, flags]) ==> <button id='' left='' top='' width='' height='' text='' flags='' />
3. I think the gadget classes / flags / etc .. should be named exactly as they are in PB, e.g. ButtonGadget (and not button) or PB_Button_Toggle (and not Toggle)
Yes, need to use everytime the SAME names that uses in PB to avoid confusions/conflicts.

So, #PB_Any will be the same in id='#PB_any' instead of id='1'. BTW, If you use constants as ID, there should be there to.

Code: Select all

<enum>
  <constant id='#MyButton' />
   ... etc
</enum>

...

<id='#MyButton' top=30 etc
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

gnozal wrote:Good idea, indeed.
1. I assume 'Id' is the gadget number ? How would you implement #PB_Any ?
2. Could you document your 'rules of translation' for each gadget / window / etc.., like ButtonGadget(id, left, top, width, height, text [, flags]) ==> <button id='' left='' top='' width='' height='' text='' flags='' />
3. I think the gadget classes / flags / etc .. should be named exactly as they are in PB, e.g. ButtonGadget (and not button) or PB_Button_Toggle (and not Toggle)
sorry no time right now... work is work.

we will discuss about this tonight or tomorrow or later - in weekend - quietly.

the goal of this topic is only to discuss - before implementing.
so at the moment there's no rules. i'm just wondering what should be the best...

good afternoon :)
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Flype wrote:the goal of this topic is only to discuss - before implementing.
so at the moment there's no rules. i'm just wondering what should be the best...
Sorry, I was just thinking loud :wink: ... thinking of how adding a PBML export function to PureFORM (should not be that difficult, just altering the code generation routine).
If PBML becomes usefull for the PB community, I will add this function ... once the PBML concept is finalized.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

yeah, happy to have your future support when it's done 8)
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
bender-rulez
User
User
Posts: 49
Joined: Mon Mar 14, 2005 11:30 am

Post by bender-rulez »

How is the progress?

I hope there will be a linux version, that would be fine, cause I could need it very well! :-)
mrjiles
Enthusiast
Enthusiast
Posts: 238
Joined: Fri Aug 18, 2006 7:21 pm
Location: IL

Post by mrjiles »

Any updates on PBML? Uh oh, if this gets off the ground, maybe we can start work on PBSS (PureBasic Style Sheets)! Gadget uniformity!
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Post by Seymour Clufley »

Sorry to be shallow, but the name "PBML" sounds and looks cool as f***. Sounds really high-powered.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

I find the word "fork" very cool, as well as "fool". "fill", "fire" (well, okay, that one is perhaps more on the warm side), and all those other interesting f*** words...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply