Ice_Knight
New Member
Pikapika, pikachu. pika?
Posts: 46
inherit
269419
0
Aug 23, 2024 8:21:17 GMT -8
Ice_Knight
Pikapika, pikachu. pika?
46
May 2024
cookieknight
|
Alert
Jun 2, 2024 8:41:50 GMT -8
Post by Ice_Knight on Jun 2, 2024 8:41:50 GMT -8
how do you make a Proboards Alert window appear?
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,312
January 2004
todge
|
Post by Todge on Jun 4, 2024 13:35:07 GMT -8
how do you make a Proboards Alert window appear? pb.window.alert('Alert Title', 'Alert Content', { options }); More information about the proBoards API window can be found here.
|
|
Ice_Knight
New Member
Pikapika, pikachu. pika?
Posts: 46
inherit
269419
0
Aug 23, 2024 8:21:17 GMT -8
Ice_Knight
Pikapika, pikachu. pika?
46
May 2024
cookieknight
|
Alert
Jun 7, 2024 3:09:41 GMT -8
Post by Ice_Knight on Jun 7, 2024 3:09:41 GMT -8
How do you assign it to a function?
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,943
December 2005
horace
|
Post by Chris on Jun 7, 2024 23:59:20 GMT -8
Instead of creating a dialog from scratch you could use the built-in functions provided by Proboards. There are several functions varying in degree of complexity and all act as a frontend for the jQuery dialog widget. - proboards.alert(title, statement)
This is the simplest of them all and is analogous to the javascript window.alert method with the exception that it is non-modal so will not block all execution until a user action has been taken (this means scripts can continue running in the background). The title argument is optional and if omitted then "Alert" will be used as the title. Statement can be an HTML string which is also an improvement over the native alert.
![proboards.alert](http://i.imgur.com/5UqTWne.png) proboards.alert('<span style="font-size:2em;">H</span>ello <span style="font-size:2em;">W</span>orld') - proboards.confirm(question, onYes)
This would be the counterpart to the window.confirm method which asks for yes/no input from the user. It is non-modal and question can be HTML. The onYes argument expects a function which will be called if the user chooses yes.
![proboards.confirm](http://i.imgur.com/MQAXqe5.png) proboards.confirm('<span style="font-size:2em;">H</span>ello <span style="font-size:2em;">W</span>hirled?', function(){console.log('Confirmed! world still spinning');} ) - proboards.dialog(id, options)
This one is closest to the widget and allows passing options directly to the widget. The id would be the id of a previously used dialog div but if it doesn't exist then it will be created. This is still a frontend for the widget so it adds a few things to make it easier than working directly with the widget so along with the standard ui-dialog options you can also add an html entry in options to specify content for the dialog.
![proboards.dialog](http://i.imgur.com/OwQDypP.png) proboards.dialog('world', { title:'Scarface', html:'<span style="font-size:2em;">G</span>oodbye <span style="font-size:2em;">W</span>orld', buttons: { 'Say hello to my little friend': function(){ $(this).dialog('close'); } } } )
|
|
Ice_Knight
New Member
Pikapika, pikachu. pika?
Posts: 46
inherit
269419
0
Aug 23, 2024 8:21:17 GMT -8
Ice_Knight
Pikapika, pikachu. pika?
46
May 2024
cookieknight
|
Post by Ice_Knight on Jun 8, 2024 1:00:43 GMT -8
It works now, thanks Chris!
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,943
December 2005
horace
|
Alert
Jun 8, 2024 6:49:29 GMT -8
Post by Chris on Jun 8, 2024 6:49:29 GMT -8
I should note that the examples given above use the proboards namespace (circa 2013) instead of the newer pb namespace (recommended) but still works in the current platform version. It will still be a breaking change in V6 since that introduces pb.dialog instead of continuing to use pb.window anyway
|
|
Ice_Knight
New Member
Pikapika, pikachu. pika?
Posts: 46
inherit
269419
0
Aug 23, 2024 8:21:17 GMT -8
Ice_Knight
Pikapika, pikachu. pika?
46
May 2024
cookieknight
|
Alert
Jun 8, 2024 8:56:24 GMT -8
Post by Ice_Knight on Jun 8, 2024 8:56:24 GMT -8
I plan on using proboards.alert because its the only one that works for me.
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,943
December 2005
horace
|
Post by Chris on Jun 9, 2024 9:16:48 GMT -8
pb.window.alert links to proboards.alert under the hood basically just passing the arguments on, so if it didn't work, then it most likely was a syntax error in the argument, which got fixed when you had to rewrite it for the OG API. It would have generated an error in the browser's console, which would have led you to the exact line and column/character where the error occurred. This is why it is so much better to give a forum URL where the issue is occurring so it can be examined for such errors rather than making wild guesses as to what might be occurring.
|
|