It is not an issue. Try to remember that ‘touch’ and ‘tap’ are different events. If you are handling one of them (and returning ‘true’ to stop handling) you have to be aware that there may be components using the other event.
If you are using any 3rd party components you may handle both events , touch and tap.
In one listener you are implementing your logic in second one you are just creating dummy listener returning ‘true’ to stop processing. [import]uid: 145499 topic_id: 25953 reply_id: 130615[/import]
Works like a charm! Much appreciated. And really good to know about the Corona touch / tap issue. [import]uid: 177244 topic_id: 25953 reply_id: 130614[/import]
It is not an issue. Try to remember that ‘touch’ and ‘tap’ are different events. If you are handling one of them (and returning ‘true’ to stop handling) you have to be aware that there may be components using the other event.
If you are using any 3rd party components you may handle both events , touch and tap.
In one listener you are implementing your logic in second one you are just creating dummy listener returning ‘true’ to stop processing. [import]uid: 145499 topic_id: 25953 reply_id: 130615[/import]
Can you add a nativeTextfield to a widget window?
Thanks
Larry
DoubleSlashDesign.com
[import]uid: 11860 topic_id: 25953 reply_id: 131022[/import]
@x-pressive.com
i have found a serious problem!!
your text field (widget candy) cannot type Chinese character!!
Because your checking Mechanism.
It checkd every “key-in word”.
For example chinese character is combined by several character.
Not pure “letter”…it makes me can’t use your widget candy.
my app wanna sell all around the world. so Not just support “English” can u check this? [import]uid: 25057 topic_id: 25953 reply_id: 131023[/import]
Can you add a nativeTextfield to a widget window?
Thanks
Larry
DoubleSlashDesign.com
[import]uid: 11860 topic_id: 25953 reply_id: 131022[/import]
@x-pressive.com
i have found a serious problem!!
your text field (widget candy) cannot type Chinese character!!
Because your checking Mechanism.
It checkd every “key-in word”.
For example chinese character is combined by several character.
Not pure “letter”…it makes me can’t use your widget candy.
my app wanna sell all around the world. so Not just support “English” can u check this? [import]uid: 25057 topic_id: 25953 reply_id: 131023[/import]
@doubleslashdesign: Inserting a native input text directly into a window would not make sense because a) native inputs are not part of the display object hirarchy and b) the user won’t be able to see them completely when the on-screen keyboard is launched. However, you can use your custom native input texts for Widget Candy text input, of course. See included code sample “sample_input_text_custom.lua” which shows how to use custom native input text fields with Widget Candy.
@OwenYang: would it be of help for you if character validation could be disabled for input texts? [import]uid: 10504 topic_id: 25953 reply_id: 131200[/import]
?x-pressive.com
yes , it can help definitely.
one more thing , can i disable key-in music?(or disable all music)
I have found if i use your widget.
It would automatically close background music.
For example, if user’s listening to music. It would be stopped.
thanks , i like your widget :), hope this make u better [import]uid: 25057 topic_id: 25953 reply_id: 131207[/import]
Next update will use a fixed audio channel for widget sounds (audio channel #1) that can also be changed using the new command GUI.SetAudioChannel(channelNumber). This should solve it.
To disable character validation for input texts, set the .allowedChars property of your input text to nil. This should also disable the validation.
[import]uid: 10504 topic_id: 25953 reply_id: 131214[/import]
@doubleslashdesign: Inserting a native input text directly into a window would not make sense because a) native inputs are not part of the display object hirarchy and b) the user won’t be able to see them completely when the on-screen keyboard is launched. However, you can use your custom native input texts for Widget Candy text input, of course. See included code sample “sample_input_text_custom.lua” which shows how to use custom native input text fields with Widget Candy.
@OwenYang: would it be of help for you if character validation could be disabled for input texts? [import]uid: 10504 topic_id: 25953 reply_id: 131200[/import]
?x-pressive.com
yes , it can help definitely.
one more thing , can i disable key-in music?(or disable all music)
I have found if i use your widget.
It would automatically close background music.
For example, if user’s listening to music. It would be stopped.
thanks , i like your widget :), hope this make u better [import]uid: 25057 topic_id: 25953 reply_id: 131207[/import]
Next update will use a fixed audio channel for widget sounds (audio channel #1) that can also be changed using the new command GUI.SetAudioChannel(channelNumber). This should solve it.
To disable character validation for input texts, set the .allowedChars property of your input text to nil. This should also disable the validation.
[import]uid: 10504 topic_id: 25953 reply_id: 131214[/import]
Hi,
just bought the library and played around with it a few minutes.
I really like it, but I found that in a confirm alert the buttons always are placed on a horizontal line.
This is not practical if you have more text on the buttons or you are e.g. using 3 or more buttons.
As a fast hack I introduced the paramter
bOrder = “vertical”
If you set this the buttons in the confirm alert window will be stacked vertically.
If you want this just replace the V.Confirm function with the one provided below.
Attention: It was just a fast hack, I use 40 pixels to space the buttons vertically. If you use highres artworks I guess you would need to change this to 80 pixels.
@X-PRESSIVE: If you like it maybe you can improve on it and integrate it, so I won’t have to change this again with every update.
Best,
Andreas
[lua]----------------------------------------------------------------
– PUBLIC: ALERT WINDOW
V.Confirm = function (Props)
if Props.theme == nil then Props.theme = V.defaultTheme end
local i, Grp, Win, Tmp
local Theme = V.Themes[Props.theme]; if Theme == nil then V.error("!!! Widgets.Alert(): Specified theme does not exist."); return end
local physicalW = math.round( (V.screenW - display.screenOriginX*2) )
local physicalH = math.round( (V.screenH - display.screenOriginY*2) )
V._RemoveInput()
if Props.modal == true then
if V.Fader == nil then
V.Fader = display.newRect(display.screenOriginX,display.screenOriginY,physicalW,physicalH)
V.Fader:setFillColor (0,0,0,128)
V.Fader.strokeWidth = 0
V.Fader.alpha = 0
V.Fader:addEventListener(“touch”, function() V._RemoveInput(); return true end)
end
transition.to (V.Fader, {time = 750, alpha = 1.0})
V.numModals = V.numModals + 1
end
Grp = display.newGroup()
Grp.x = display.screenOriginX
Grp.y = display.screenOriginY
Grp.bounds = {0,0,physicalW,physicalH} – MINX,MINY,WIDTH,HEIGHT INSIDE GROUP
Grp.winName = “AlertWin”…V.widgetCount; V.widgetCount = V.widgetCount + 1
Win = V.NewWindow(
{
name = Grp.winName,
x = “center”,
y = “center”,
scale = Props.scale ~= nil and Props.scale or 1.0,
parentGroup = Grp,
width = Props.width ~= nil and Props.width or “35%”,
minHeight = 40,
height = Props.height ~= nil and Props.height or “auto”,
theme = Props.theme,
caption = Props.title ~= nil and Props.title or “ALERT”,
textAlign = “center”,
alpha = Props.alpha ~= nil and Props.alpha or 1.0,
icon = Props.icon ~= nil and Props.icon or 0,
margin = Props.margin ~= nil and Props.margin or 8,
shadow = Props.shadow == nil and true or Props.shadow,
dragX = Props.dragX ~= nil and Props.dragX or false,
dragY = Props.dragY ~= nil and Props.dragY or false,
closeButton = Props.closeButton ~= nil and Props.closeButton or false,
onClose = Props.onClose,
} )
Tmp = V.NewText(
{
x = “center”,
y = “auto”,
width = “100%”,
height = “auto”,
parentGroup = Grp.winName,
theme = Props.theme,
caption = Props.caption,
textAlign = “center”,
} )
local spacing = 8
local winW = Win.Props.Shape.w - Win.Props.margin*2
local pressFunc = Props.onPress ~= nil and Props.onPress or function() end
local releaseFunc = Props.onRelease ~= nil and Props.onRelease or function() end
local winH = Win.Props.Shape.h - Win.Props.margin*2
local butW
local butX
local tmpVx
local tmpVy
if Props.bOrder == “vertical” then
butW = winW
butX = Win.Props.margin
else
butW = winW / #Props.buttons
butX = Win.Props.margin + (winW - #Props.buttons * butW) / 2
end
for i = 1, #Props.buttons do
local topMargin = i == 1 and 10 or 0
if Props.bOrder == “vertical” then
tmpVx = butX
tmpVy = winH + (i-1)* 40
else
tmpVx = butX + (i-1)*butW
tmpVy = “auto”
end
Tmp = V.NewButton(
{
x = tmpVx,
y = tmpVy,
width = butW,
textAlign = “center”,
theme = Props.theme,
parentGroup = Grp.winName,
caption = Props.buttons[i].caption,
icon = Props.buttons[i].icon,
topMargin = topMargin,
myNumber = i,
onPress = function(event) event.button = event.Props.myNumber; pressFunc (event) end,
onRelease = function(event) event.button = event.Props.myNumber; releaseFunc(event); V.Widgets[event.Props.myWindow].parent:destroy() end,
} )
end
Win:layout(true)
– PLACE FADER ON TOP OF EVERYTHING, BUT BELOW MODAL WINDOWS
if V.Fader then display.getCurrentStage():insert(display.getCurrentStage().numChildren-V.numModals, V.Fader) end
– PUBLIC METHOD: DESTROY PROGRAMMATICALLY
function Grp:destroy()
V.numModals = V.numModals - 1
if V.numModals == 0 then V.Fader:removeSelf(); V.Fader = nil end
V.GetHandle(self.winName):destroy()
self:removeSelf()
end
V.print("–> Widgets.Confirm(): Created dialog window with “…#Props.buttons…” buttons.")
return Grp
end[/lua] [import]uid: 107675 topic_id: 25953 reply_id: 137100[/import]
Thanks for the suggestions, Andreas.
Widget Candy has just been updated to 1.0.87, which contains the following improvements:
* Added two new button properties to alert and confirmation windows (.width and .newLine). The optional .width property specifies the width of a button (can be a number or a percent string), while the optional .newLine property places a button on a new line, if set to true. Use it to place buttons vertically within a confirmation window. See updated manual, confirmation window properties, for details.
* Fixed position issue with alert and confirmation windows when device orientation was changed.
Here is an example on how to display three buttons in a confirmation window, where the buttons are placed vertically:
[lua]buttons =
{
{icon = 15, caption = “Yes”, width = “100%”},
{icon = 16, caption = “No” , width = “100%”, newLine = true},
{icon = 17, caption = “Perhaps” , width = “100%”, newLine = true},
},[/lua]
To keep informed about updates: Twitter @XPRESSIVECOM [import]uid: 10504 topic_id: 25953 reply_id: 137192[/import]
Hi X-PRESSIVE (Mike? Is it you,Mike?),
thanks for the fast help!
Introducing the newLine-property is a really great idea, so much better than my suggestion, and the width-per-button is much appreciated, too!
Best,
Andreas [import]uid: 107675 topic_id: 25953 reply_id: 137197[/import]
I have a question about the Widget library. Does it work when multi-touch is activated? Will I be able to successfully use a slider while pressing a button at the same time? [import]uid: 69494 topic_id: 25953 reply_id: 137212[/import]
Is there any sort of datepicker in this lib? [import]uid: 132483 topic_id: 25953 reply_id: 137298[/import]
Just wanted to say that I finally posted my first app using Widget Candy to Google Play. I really like the look and feel that I could achieve for an app that requires buttons and lists. You can check out the app, Oh Behave!, here: https://play.google.com/store/apps/details?id=com.thinkatorium.ohbehavelite&feature=search_result#?t=W251bGwsMSwyLDEsImNvbS50aGlua2F0b3JpdW0ub2hiZWhhdmVsaXRlIl0. [import]uid: 104085 topic_id: 25953 reply_id: 137300[/import]
Hi,
just bought the library and played around with it a few minutes.
I really like it, but I found that in a confirm alert the buttons always are placed on a horizontal line.
This is not practical if you have more text on the buttons or you are e.g. using 3 or more buttons.
As a fast hack I introduced the paramter
bOrder = “vertical”
If you set this the buttons in the confirm alert window will be stacked vertically.
If you want this just replace the V.Confirm function with the one provided below.
Attention: It was just a fast hack, I use 40 pixels to space the buttons vertically. If you use highres artworks I guess you would need to change this to 80 pixels.
@X-PRESSIVE: If you like it maybe you can improve on it and integrate it, so I won’t have to change this again with every update.
Best,
Andreas
[lua]----------------------------------------------------------------
– PUBLIC: ALERT WINDOW
V.Confirm = function (Props)
if Props.theme == nil then Props.theme = V.defaultTheme end
local i, Grp, Win, Tmp
local Theme = V.Themes[Props.theme]; if Theme == nil then V.error("!!! Widgets.Alert(): Specified theme does not exist."); return end
local physicalW = math.round( (V.screenW - display.screenOriginX*2) )
local physicalH = math.round( (V.screenH - display.screenOriginY*2) )
V._RemoveInput()
if Props.modal == true then
if V.Fader == nil then
V.Fader = display.newRect(display.screenOriginX,display.screenOriginY,physicalW,physicalH)
V.Fader:setFillColor (0,0,0,128)
V.Fader.strokeWidth = 0
V.Fader.alpha = 0
V.Fader:addEventListener(“touch”, function() V._RemoveInput(); return true end)
end
transition.to (V.Fader, {time = 750, alpha = 1.0})
V.numModals = V.numModals + 1
end
Grp = display.newGroup()
Grp.x = display.screenOriginX
Grp.y = display.screenOriginY
Grp.bounds = {0,0,physicalW,physicalH} – MINX,MINY,WIDTH,HEIGHT INSIDE GROUP
Grp.winName = “AlertWin”…V.widgetCount; V.widgetCount = V.widgetCount + 1
Win = V.NewWindow(
{
name = Grp.winName,
x = “center”,
y = “center”,
scale = Props.scale ~= nil and Props.scale or 1.0,
parentGroup = Grp,
width = Props.width ~= nil and Props.width or “35%”,
minHeight = 40,
height = Props.height ~= nil and Props.height or “auto”,
theme = Props.theme,
caption = Props.title ~= nil and Props.title or “ALERT”,
textAlign = “center”,
alpha = Props.alpha ~= nil and Props.alpha or 1.0,
icon = Props.icon ~= nil and Props.icon or 0,
margin = Props.margin ~= nil and Props.margin or 8,
shadow = Props.shadow == nil and true or Props.shadow,
dragX = Props.dragX ~= nil and Props.dragX or false,
dragY = Props.dragY ~= nil and Props.dragY or false,
closeButton = Props.closeButton ~= nil and Props.closeButton or false,
onClose = Props.onClose,
} )
Tmp = V.NewText(
{
x = “center”,
y = “auto”,
width = “100%”,
height = “auto”,
parentGroup = Grp.winName,
theme = Props.theme,
caption = Props.caption,
textAlign = “center”,
} )
local spacing = 8
local winW = Win.Props.Shape.w - Win.Props.margin*2
local pressFunc = Props.onPress ~= nil and Props.onPress or function() end
local releaseFunc = Props.onRelease ~= nil and Props.onRelease or function() end
local winH = Win.Props.Shape.h - Win.Props.margin*2
local butW
local butX
local tmpVx
local tmpVy
if Props.bOrder == “vertical” then
butW = winW
butX = Win.Props.margin
else
butW = winW / #Props.buttons
butX = Win.Props.margin + (winW - #Props.buttons * butW) / 2
end
for i = 1, #Props.buttons do
local topMargin = i == 1 and 10 or 0
if Props.bOrder == “vertical” then
tmpVx = butX
tmpVy = winH + (i-1)* 40
else
tmpVx = butX + (i-1)*butW
tmpVy = “auto”
end
Tmp = V.NewButton(
{
x = tmpVx,
y = tmpVy,
width = butW,
textAlign = “center”,
theme = Props.theme,
parentGroup = Grp.winName,
caption = Props.buttons[i].caption,
icon = Props.buttons[i].icon,
topMargin = topMargin,
myNumber = i,
onPress = function(event) event.button = event.Props.myNumber; pressFunc (event) end,
onRelease = function(event) event.button = event.Props.myNumber; releaseFunc(event); V.Widgets[event.Props.myWindow].parent:destroy() end,
} )
end
Win:layout(true)
– PLACE FADER ON TOP OF EVERYTHING, BUT BELOW MODAL WINDOWS
if V.Fader then display.getCurrentStage():insert(display.getCurrentStage().numChildren-V.numModals, V.Fader) end
– PUBLIC METHOD: DESTROY PROGRAMMATICALLY
function Grp:destroy()
V.numModals = V.numModals - 1
if V.numModals == 0 then V.Fader:removeSelf(); V.Fader = nil end
V.GetHandle(self.winName):destroy()
self:removeSelf()
end
V.print("–> Widgets.Confirm(): Created dialog window with “…#Props.buttons…” buttons.")
return Grp
end[/lua] [import]uid: 107675 topic_id: 25953 reply_id: 137100[/import]