Thread Tools Display Modes
05-04-15, 03:16 PM   #1
Grim077
A Deviate Faerie Dragon
 
Grim077's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2010
Posts: 15
Static Dialog box help!

Hello! I'm new to this and i was wondering how would i go about making a button that when i click it, it asks for a confirmation. as in Yes or No. if someone could give me an example that would be amazing!

Heres my button i would like it to ask for confirmation.

Code:
local b = CreateFrame("BUTTON", nil, UIParent, "UIPanelButtonTemplate");
  b:SetSize(135,25)
  b:SetText(myWhite..'Button Text')
  b:SetPoint("CENTER",250,254)
  b:RegisterForClicks("AnyUp")
  b:SetScript("OnClick", function() -- Do Something!)
__________________
I see you, But you can't see me!

Last edited by Grim077 : 05-04-15 at 03:41 PM.
  Reply With Quote
05-04-15, 07:05 PM   #2
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 309
http://www.wowwiki.com/Creating_simp...p_dialog_boxes

Call the static popup upon clicking.

Code:
StaticPopup_Show("YOUR_STATIC_POPUP_NAME")
  Reply With Quote
05-04-15, 07:08 PM   #3
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Originally Posted by Tim View Post
http://www.wowwiki.com/Creating_simp...p_dialog_boxes

Call the static popup upon clicking.

Code:
StaticPopup_Show("YOUR_STATIC_POPUP_NAME")
WoWWiki is woefully outdated in most places, since their main contributors started WoWPedia in 2010. The WoWPedia version (with corrections not found on the WoWWiki version) can be found here: http://wow.gamepedia.com/Creating_si...p_dialog_boxes
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
05-04-15, 07:54 PM   #4
Grim077
A Deviate Faerie Dragon
 
Grim077's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2010
Posts: 15
is there anyway you could provide an example of it in working condition?
__________________
I see you, But you can't see me!
  Reply With Quote
05-04-15, 08:13 PM   #5
Grim077
A Deviate Faerie Dragon
 
Grim077's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2010
Posts: 15
so far i have

Code:
local b = CreateFrame("BUTTON", nil, UIParent, "UIPanelButtonTemplate");
  b:SetSize(135,25)
  b:SetText(cWhite..'Button Name')
  b:SetPoint("CENTER",250,254)
  b:RegisterForClicks("AnyUp")
  StaticPopupDialogs["EXAMPLE_NAME"] = {
  text = "Example: select Yes to run the code or select No to close the popup.",
  button1 = "Yes",
  button2 = "No",
  OnAccept = function(self) 
          -- Do Something
	end,
  OnCancel = function (_,reason)
      if reason == "timeout" or reason == "clicked" then
          StaticPopup_Hide("EXAMPLE_NAME")
      else
          -- "override" ...?
      end;
  end,
  timeout = 30,
  whileDead = true,
  hideOnEscape = true,
  }
  b:SetScript('OnClick', StaticPopup_Show("EXAMPLE_NAME"))
__________________
I see you, But you can't see me!
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Static Dialog box help!


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off