Page 1 of 2

What about a PureBasic Markup Language : PBML ?

Posted: Thu Jan 25, 2007 11:52 pm
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.

Posted: Fri Jan 26, 2007 12:34 am
by flaith
really impressive and it's a good idea !

Posted: Fri Jan 26, 2007 1:11 am
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.

Posted: Fri Jan 26, 2007 2:57 am
by Intrigued
Reminds me of XAML.

Interesting for sure.

Posted: Fri Jan 26, 2007 8:44 am
by KarLKoX
Great idea for a great feature ! This is really a plus for PB :)
Merkik ;)

Posted: Fri Jan 26, 2007 9:23 am
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)

Posted: Fri Jan 26, 2007 10:02 am
by JCV
nice. It can do many possibilities.
Yahoo Messenger uses something like that for its themes and also with others. :D

Posted: Fri Jan 26, 2007 1:51 pm
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

Posted: Fri Jan 26, 2007 2:27 pm
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 :)

Posted: Fri Jan 26, 2007 2:53 pm
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.

Posted: Fri Jan 26, 2007 4:07 pm
by Flype
yeah, happy to have your future support when it's done 8)

Posted: Fri Jun 08, 2007 2:28 pm
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! :-)

Posted: Thu May 01, 2008 9:09 pm
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!

Posted: Fri May 02, 2008 12:40 am
by Seymour Clufley
Sorry to be shallow, but the name "PBML" sounds and looks cool as f***. Sounds really high-powered.

Posted: Fri May 02, 2008 4:59 pm
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...