c# pdf viewer open source : Rearrange pdf pages SDK Library service wpf asp.net web page dnn World%20of%20Warcraft%20Programming%20(2nd%20Edition)48-part1847

Chapter 23
Creating Dropdown Menus 439
info.text = “Disabled Button“
info.disabled = true
UIDropDownMenu_AddButton(info)
info = UIDropDownMenu_CreateInfo()
info.text = “Colored Text“
info.colorCode = “|cFF33FF22“
UIDropDownMenu_AddButton(info)
info = UIDropDownMenu_CreateInfo()
info.text = “Not Clickable“
info.notClickable = true
UIDropDownMenu_AddButton(info)
info = UIDropDownMenu_CreateInfo()
info.text = “Not Checkable“
info.notCheckable = true
UIDropDownMenu_AddButton(info)
info = UIDropDownMenu_CreateInfo()
info.text = “Button with Tooltip“
info.tooltipTitle = “Tooltip title“
info.tooltipText = “Contents of the tooltip“
UIDropDownMenu_AddButton(info)
info = UIDropDownMenu_CreateInfo()
info.text = “Centered Text“
info.justifyH = “CENTER“
info.notCheckable = true
UIDropDownMenu_AddButton(info)
info = UIDropDownMenu_CreateInfo()
info.text = “Text with custom font“
info.fontObject = SystemFont_Small
UIDropDownMenu_AddButton(info)
end
Figure 23-6: Dropdown menu showing various buttons
Rearrange pdf pages - re-order PDF pages in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Support Customizing Page Order of PDF Document in C# Project
how to reorder pages in pdf online; how to reorder pages in pdf file
Rearrange pdf pages - VB.NET PDF Page Move Library: re-order PDF pages in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Sort PDF Document Pages Using VB.NET Demo Code
how to rearrange pdf pages reader; pdf change page order acrobat
440
Part III
Advanced Addon Techniques
Function Menu Items
Any menu item can be set to call a function when it is clicked by using the
following set of attributes:
func
—The function to be called when the button is clicked.
arg1
—An argument to be passed to the function when it is called.
arg2
—Another argument to be passed to the function when it is called.
keepShownOnClick
—A boolean flag indicating whether or not the drop-
down menu should remain showing instead of disappearing when the
button is clicked.
Although the attributes are called
arg1
and
arg2
, they are actually the
secondandthirdarguments thatarepassedtothefunction. The firstargument
is the button itself (which contains all of the valid attributes in the original
info table).
Add a function-enabledbutton toyour dropdown using the following code:
info = UIDropDownMenu_CreateInfo()
info.text = “Function Button“
function info.func(button, arg1, arg2)
print(“CALL: Arg1: “ .. tostring(arg1) .. “ Arg2: “ .. tostring(arg2))
end
info.arg1 = “Foo“
info.arg2 = “Bar“
UIDropDownMenu_AddButton(info)
CheckButton Menu Items
Many dropdown menus are used for configuration, such as the ‘‘Player vs.
Player’’ setting that can be accessed by right-clicking the player frame. These
toggleable items make use of the checkbox included in each dropdown entry,
and the
checked
attribute to signify that the itemis checked.
info = UIDropDownMenu_CreateInfo()
info.text = “Toggleable setting“
info.checked = SOME_SETTING
function info.func(button, arg1, arg2)
SOME_SETTING = not SOME_SETTING
print(“SOME_SETTING is “ .. tostring(SOME_SETTING)
end
UIDropDownMenu_AddButton(info)
This code defines a new button that can be clicked to change the value of
the global variable
SOME_SETTING
.Because it starts off with a value of
nil
,the
C# TIFF: How to Reorder, Rearrange & Sort TIFF Pages Using C# Code
C# TIFF - Sort TIFF File Pages Order in C#.NET. Reorder, Rearrange and Sort TIFF Document Pages in C#.NET Application. C# TIFF Page Sorting Overview.
how to rearrange pages in pdf using reader; change page order pdf reader
VB.NET TIFF: Modify TIFF File by Adding, Deleting & Sort TIFF
you want to change or rearrange current TIFF &ltsummary> ''' Sort TIFF document pages in designed powerful & profession imaging controls, PDF document, image
reorder pages pdf; pdf reverse page order preview
Chapter 23
Creating Dropdown Menus 441
button won’t be checked to start.Every time the button is clicked it will toggle
the setting and printa messageto the chat frame.Figure23-7 shows the button
when the
SOME_SETTING
is
true
.
Figure 23-7: Dropdown Test showing the‘‘Toggleable setting’’ option
If you don’t want the menu to be hidden when someone clicks to toggle a
setting,youcan usethe
keepShownOnClick
attribute. The handlerfunction will
still be called, and the checkbox will change without hiding the menu.
ColorPicker Menu Items
Adropdown menu can contain small color swatches that display a color, and
can beclickedtoshowa color pickerframe.These allow foreasycustomization
ofcolorsin ahierarchical dropdown menu.Thecolorswatch canbecustomized
with the following attributes:
hasColorSwatch
—A boolean flag indicating if the menu item should
display a color swatch. This swatch can then be clicked to open the color
picker frame.
r
—The red component of the color swatch (0–255).
g
—The green component of the color swatch (0–255).
b
—The blue component of the color swatch (0–255).
swatchFunc
—A function called by the color picker when the color has
changed.
hasOpacity
—A flag (
1
,
nil
) that adds the opacity slider to the color
picker frame.
VB.NET PDF File & Page Process Library SDK for vb.net, ASP.NET
page directly. Moreover, when you get a PDF document which is out of order, you need to rearrange the PDF document pages. In these
rearrange pdf pages online; pdf change page order online
Online Merge PDF files. Best free online merge PDF tool.
Then press the button below and download your PDF. The perfect conversion tool. By dragging your pages in the editor area you can rearrange them or delete
how to rearrange pdf pages online; move pages within pdf
442
Part III
Advanced Addon Techniques
opacity
—The percentage of opacity, as a value between
0.0
and
1.0
,
indicating the transparency of the selected color.
opacityFunc
—A function called by the color picker when the opacity
changes.
cancelFunc
—A function called by the color picker when the user clicks
the Cancel button. This function is passed the previous values to which
the color picker is reverting.
The following example uses the color picker to change the color of the
player’snameontheplayerframe.Thecodeaccessesthefontstring
PlayerName
to get the current color values, as well as to set the new color.
info = UIDropDownMenu_CreateInfo()
info.text = “Button Text Color“
info.hasColorSwatch = true
local oldr, oldg, oldb, olda = DropDownTest_ButtonText:GetTextColor()
info.r = oldr
info.g = oldg
info.b = oldb
function info.swatchFunc()
local r, g, b = ColorPickerFrame:GetColorRGB()
DropDownTest_ButtonText:SetTextColor(r, g, b)
end
function info.cancelFunc(prev)
DropDownTest_ButtonText:SetTextColor(prev.r, prev.g, prev.g)
end
UIDropDownMenu_AddButton(info)
When the dropdown is initialized, the function stores the current color of
the text string using
DropDownTest_ButtonText:GetTextColor()
,storing the
returns in the
r
,
g
, and
b
attributes of the new menu item. When the user
changes the color on the picker, the swatch function fetches the selected color
from the color picker frame and changes the color of the text.
When the cancel function is called, a table containing the previous color
is passed, so the cancel function uses it to restore the original color. This
definition creates the menu item shown in Figure 23-8. When the user clicks
the color swatch, the color picker frame (see Figure 23-9) opens. The color of
the text on the dropdown button is then changed to reflect the new choice.
Figure 23-8: Menu item to change the color of the button text
C# PowerPoint - How to Process PowerPoint
pages simply with a few lines of C# code. C# Codes to Sort Slides Order. If you want to use a very easy PPT slide dealing solution to sort and rearrange
how to move pages in a pdf file; change page order in pdf file
VB.NET Word: How to Process MS Word in VB.NET Library in .NET
well programmed Word pages sorter to rearrange Word pages in extracting single or multiple Word pages at one & profession imaging controls, PDF document, image
change page order pdf acrobat; pdf change page order
Chapter 23
Creating Dropdown Menus 443
Figure 23-9: The ColorPicker frame that appears when the color swatch is selected
Using Dropdowns for Selection
The examples earlier in this chapter used dropdowns to create popup menus.
Although these are used throughout the default user interface, dropdowns
can also be used to provide a selection box.
Three utility functions are provided to facilitate the graphical setup of the
frame:
UIDropDownMenu_SetWidth(frame, width, padding)
frame
—The dropdown frame to adjust.
width
—The desired width of the frame.
padding
—An amount of padding on either side of the text; defaults
to 25.
UIDropDownMenu_SetButtonWidth(frame, width)
frame
—The dropdown frame to adjust.
width
—The desired width of the button.
UIDropDownMenu_JustifyText(frame, justify)
frame
—The dropdown frame to adjust.
justify
—The desired justification of the text,
LEFT
,
RIGHT
,
CENTER
.
Any dropdown that inherits from
UIDropDownMenuTemplate
is capable of
being used as a selection dropdown. Run the following Lua script in-game to
create a new sample menu:
if not DropDownMenuTest then
CreateFrame(“Frame“, “DropDownMenuTest“, UIParent,
VB.NET PowerPoint: Sort and Reorder PowerPoint Slides by Using VB.
page will teach you to rearrange and readjust amount of robust PPT slides/pages editing methods and powerful & profession imaging controls, PDF document, image
reordering pages in pdf; move pages in pdf online
Process Images in Web Image Viewer | Online Tutorials
used document types are supported, including PDF, multi-page easy to process image and file pages with the deleting a thumbnail, and you can rearrange the file
how to change page order in pdf acrobat; how to reverse page order in pdf
444
Part III
Advanced Addon Techniques
“UIDropDownMenuTemplate“)
end
DropDownMenuTest:ClearAllPoints()
DropDownMenuTest:SetPoint(“CENTER“, 0, 0)
DropDownMenuTest:Show()
local items = {
“Alpha“,
“Beta“,
“Gamma“,
“Delta“,
}
local function OnClick(self)
UIDropDownMenu_SetSelectedID(DropDownMenuTest, self:GetID())
end
local function initialize(self, level)
local info = UIDropDownMenu_CreateInfo()
for k, v in pairs(items) do
info = UIDropDownMenu_CreateInfo()
info.text = v
info.value = v
info.func = OnClick
UIDropDownMenu_AddButton(info, level)
end
end
UIDropDownMenu_Initialize(DropDownMenuTest, initialize)
UIDropDownMenu_SetWidth(DropDownMenuTest, 100);
UIDropDownMenu_SetButtonWidth(DropDownMenuTest, 124)
UIDropDownMenu_SetSelectedID(DropDownMenuTest, 1)
UIDropDownMenu_JustifyText(DropDownMenuTest, “LEFT“)
UIDropDownMenu_SetWidth
is used to adjust the size of the text portion
of the dropdown menu, in this case to a value of
100
.You should ensure
that the dropdown is wide enough to display any of the possible items.
UIDropDownMenu_SetButtonWidth
allows you to set the width of the clickable
portion ofthe menu. Normally this is set to
24
,which is thewidth of the actual
button graphic. Here it’s set to124
,making the entire selection box clickable.
UIDropDownMenu_JustifyText
can be called to change the text jus-
tification (in this case, the text is left-justified). Finally, a call to
UIDropDownMenu_SetSelectedID
selects an item from the list to be displayed
by its index in the list. Figure 23-10 shows the resulting selection menu.
Chapter 23
Creating Dropdown Menus 445
Figure 23-10: Selection dropdown menu
Menu items can be selected by name, by value, or by numeric index
using
UIDropDownMenu_SetSelectedName
,
UIDropDownMenu_SetSelectedID
,
and
UIDropDownMenu_SetSelectedValue
.You should use whichever method
makes the most sense for you.
Automating Menu Creation with EasyMenu
The process of creating dropdowns can be tedious, especially considering
that the table definitions can be verbose. Blizzard provides a system called
EasyMenu to easethe creation of menus, allowing youtodefine themin tables
aheadof time.This reduces the amount of code youneedtowriteandlocalizes
all changes to the dropdown to a set of table definitions.
Create an addon skeleton called
EasyMenuTest
with the standard
EasyMenu.toc
and
EasyMenu.lua
.This menu will be created in Lua, without
using XML. Add the following code to
EasyMenu.lua
:
if not EasyMenuTest then
CreateFrame(“Frame“, “EasyMenuTest“, UIParent, i
“UIDropDownMenuTemplate“)
end
if not EasyMenuButton then
CreateFrame(“Button“, “EasyMenuButton“, UIParent, i
“GameMenuButtonTemplate“)
end
menuTbl = {
{
text = “Alpha“,
hasArrow = true,
menuList = {
446
Part III
Advanced Addon Techniques
{ text = “AlphaAlpha“, },
{ text = “AlphaBeta“, },
{ text = “AlphaGamma“, },
},
},
{
text = “Beta“,
hasArrow = true,
menuList = {
{ text = “BetaAlpha“, },
{ text = “BetaBeta“, },
{ text = “BetaGamma“, },
},
},
{
text = “Some Setting“,
checked = function()
return SOME_SETTING
end,
func = function()
SOME_SETTING = not SOME_SETTING
end,
},
}
EasyMenuButton:SetText(“EasyMenu Test“)
EasyMenuButton:SetPoint(“CENTER“, 0, 0)
EasyMenuButton:SetScript(“OnClick“, function(self, button)
EasyMenu(menuTbl, EasyMenuTest, “EasyMenuButton“, 0, 0, nil, 10)
end)
This example creates new button anddropdown frames and sets the button
to call the EasyMenu()
function when it is clicked. Figure 23-11 shows the
resulting menu from the table definition. You may have noticed that the
checked
attribute is set to a function here. This allows you to have dynamic
settings for checked items, because otherwise the
true
/
false
value would be
fixed when the table definition is created.
Figure 23-11: DropDown menu created using EasyMenu
Chapter 23
Creating Dropdown Menus 447
EasyMenu isextremelyuseful when youare creatinga menuofmostlystatic
items, but falls short when working with more dynamic menus.
Creating Dynamic Menus
As you create more advanced addons, you may need to create a dropdown
menu based on returns from an API function. Occasionally you can create
the table ahead of time and use EasyMenu, but you can always use the more
verbose method introduced at the start of the chapter.
Type and run the following code snippet to create a dropdown that shows
the status of the ‘‘World Explorer’’ achievement; showing you which zones
you have explored and what areas youhave not:
if not ExplorerDropDown then
CreateFrame(“Frame“, “ExplorerDropDown“, UIParent, i
“UIDropDownMenuTemplate“)
end
ExplorerDropDown:ClearAllPoints()
ExplorerDropDown:SetPoint(“TOPLEFT“, 50, -100)
ExplorerDropDown:Show()
local function initialize(self, level)
local info, achievementId
if UIDROPDOWNMENU_MENU_VALUE then
achievementId = UIDROPDOWNMENU_MENU_VALUE
else
achievementId = 46
-- Set the achievement to “World Explorer“
end
local id, name, points, completed = GetAchievementInfo(achievementId)
local numCriteria = GetAchievementNumCriteria(achievementId)
for i = 1, numCriteria do
local text, criType, completed, quantity, totalQuantity, name, i
flags, assetID, quantityString, criteriaID =
i
GetAchievementCriteriaInfo(achievementId, i)
info = UIDropDownMenu_CreateInfo()
info.text = text
info.checked = completed
if (criType == CRITERIA_TYPE_ACHIEVEMENT) and assetID then
if GetAchievementNumCriteria(assetID) > 0 then
info.hasArrow = true
info.value = assetID
end
448
Part III
Advanced Addon Techniques
end
UIDropDownMenu_AddButton(info, level)
end
end
UIDropDownMenu_Initialize(ExplorerDropDown, initialize)
UIDropDownMenu_SetWidth(ExplorerDropDown, 125)
UIDropDownMenu_SetButtonWidth(ExplorerDropDown, 124)
UIDropDownMenu_SetText(ExplorerDropDown, “World Explorer!“)
First you create the dropdown frame as in the previous examples, and
then query the achievements API to get the criteria for the ‘‘World Explorer’’
achievement (which happens to be achievement ID 46). Each criteria of the
selected achievement that is itself an achievement is tested to see if it too
contains subitems, and if so shows the arrow and sets the value attribute.
Figure 23-12 shows the dropdown menu in action.
Figure 23-12: World Explorer dropdown menu
Documents you may be interested
Documents you may be interested