MonoTouch.Dialog Editable

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

MonoTouch.Dialog Editable

Juan M Gómez
Hello,

I´m using MonoTouch.Dialog to make an editable ViewTable like the Alarm app. I use two different Element, one when I don't edit (RadioElement) and another when I am in edit mode (StringElement).  

private RootElement CreateEditablCourts (bool editable=false)

{


var root = editable? new RootElement("Juzgados") : new RootElement("Juzgados",new RadioGroup(-1));

var section = new Section ();

var courts = lawerData.getAllCourts();

foreach (var c in courts) {

var court = c;

section.Add(CreateEditableElement(court.Location,editable));

}

root.Add(section);


return root;

}


private Element CreateEditableElement (string caption, bool editable = false)

{

if (editable) 

return new StringElement (caption, () => {

new UIAlertView ().Show ();}); //NEVER TRIGGER


var radioElement = new RadioElement(caption,string.Empty);

radioElement.Tapped+= () => {
new UIAlertView ().Show ();  //WORKS

} ;


return radioElement;


}


Thanks in advance,
_jmgomez_
Juan  M Gómez


_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|

Re: MonoTouch.Dialog Editable

Miguel de Icaza-2
Your approach would only work if you reload the entire tree (call CreateEditableCourts again, and replace the root with the new value).

Miguel

On Sun, Nov 4, 2012 at 10:56 AM, Juan Manuel Gómez Álvarez <[hidden email]> wrote:
Hello,

I´m using MonoTouch.Dialog to make an editable ViewTable like the Alarm app. I use two different Element, one when I don't edit (RadioElement) and another when I am in edit mode (StringElement).  

private RootElement CreateEditablCourts (bool editable=false)

{


var root = editable? new RootElement("Juzgados") : new RootElement("Juzgados",new RadioGroup(-1));

var section = new Section ();

var courts = lawerData.getAllCourts();

foreach (var c in courts) {

var court = c;

section.Add(CreateEditableElement(court.Location,editable));

}

root.Add(section);


return root;

}


private Element CreateEditableElement (string caption, bool editable = false)

{

if (editable) 

return new StringElement (caption, () => {

new UIAlertView ().Show ();}); //NEVER TRIGGER


var radioElement = new RadioElement(caption,string.Empty);

radioElement.Tapped+= () => {
new UIAlertView ().Show ();  //WORKS

} ;


return radioElement;


}


Thanks in advance,
_jmgomez_
Juan  M Gómez


_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch



_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|

Re: MonoTouch.Dialog Editable

Juan M Gómez
Hello Miguel, 

I followed the approach in your example of DemoEditingAdvanced (I updated the Root and then called ReloadData). 

In your example below (modified to illustrate the error) I try to trigger the selected element when the rows are editing but it doesn't work. Allthough it works without editing it.

Thank you,
_jmgomez_
Juan M Gómez

void AdvancedConfigEdit (DialogViewController dvc)

{

dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Edit, delegate {

// Activate editing

// Switch the root to editable elements

dvc.Root = CreateEditableRoot(dvc.Root, true);

dvc.ReloadData();

// Activate row editing & deleting

dvc.TableView.SetEditing (true, true);

AdvancedConfigDone(dvc);

} );

}

void AdvancedConfigDone (DialogViewController dvc)

{

dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Done, delegate {

// Deactivate editing

dvc.ReloadData();

// Switch updated entry elements to StringElements

dvc.Root = CreateEditableRoot(dvc.Root, false);

dvc.TableView.SetEditing (false, true);

AdvancedConfigEdit (dvc);


} );

}

RootElement CreateEditableRoot (RootElement root, bool editable)

{

    var rootElement = new RootElement("Todo list") {

new Section()

} ;

foreach (var element in root[0].Elements) {

if(element is StringElement) {

rootElement[0].Add(CreateEditableElement (element.Caption, (element as StringElement).Value, editable));

}  else {

rootElement[0].Add(CreateEditableElement (element.Caption, (element as StringElement /*I'M ADDING THIS */).Value, editable));

}

}

    return rootElement;

}

Element CreateEditableElement (string caption, string content, bool editable)

{

return new StringElement(caption, ()=>{new UIAlertView("","",null,"").Show();}); //I'M ALSO ADDING THIS


if (editable) {

return new EntryElement(caption, "todo", content);

}  else {

return new StringElement(caption, content); 

}


}



Juan M Gómez Álvarez


2012/11/5 Miguel de Icaza <[hidden email]>
Your approach would only work if you reload the entire tree (call CreateEditableCourts again, and replace the root with the new value).

Miguel

On Sun, Nov 4, 2012 at 10:56 AM, Juan Manuel Gómez Álvarez <[hidden email]> wrote:
Hello,

I´m using MonoTouch.Dialog to make an editable ViewTable like the Alarm app. I use two different Element, one when I don't edit (RadioElement) and another when I am in edit mode (StringElement).  

private RootElement CreateEditablCourts (bool editable=false)

{


var root = editable? new RootElement("Juzgados") : new RootElement("Juzgados",new RadioGroup(-1));

var section = new Section ();

var courts = lawerData.getAllCourts();

foreach (var c in courts) {

var court = c;

section.Add(CreateEditableElement(court.Location,editable));

}

root.Add(section);


return root;

}


private Element CreateEditableElement (string caption, bool editable = false)

{

if (editable) 

return new StringElement (caption, () => {

new UIAlertView ().Show ();}); //NEVER TRIGGER


var radioElement = new RadioElement(caption,string.Empty);

radioElement.Tapped+= () => {
new UIAlertView ().Show ();  //WORKS

} ;


return radioElement;


}


Thanks in advance,
_jmgomez_
Juan  M Gómez


_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch




_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|

Re: MonoTouch.Dialog Editable

Juan M Gómez
Hello,
I finally found the solution in the Apple documentation. I need to make the rows selectable when in edit mode with the allowsSelectionDuringEditing property of UITableView.
Thanks!
_jmgomez_
Juan M Gómez


2012/11/5 Juan Manuel Gómez Álvarez <[hidden email]>
Hello Miguel, 

I followed the approach in your example of DemoEditingAdvanced (I updated the Root and then called ReloadData). 

In your example below (modified to illustrate the error) I try to trigger the selected element when the rows are editing but it doesn't work. Allthough it works without editing it.

Thank you,
_jmgomez_
Juan M Gómez

void AdvancedConfigEdit (DialogViewController dvc)

{

dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Edit, delegate {

// Activate editing

// Switch the root to editable elements

dvc.Root = CreateEditableRoot(dvc.Root, true);

dvc.ReloadData();

// Activate row editing & deleting

dvc.TableView.SetEditing (true, true);

AdvancedConfigDone(dvc);

} );

}

void AdvancedConfigDone (DialogViewController dvc)

{

dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Done, delegate {

// Deactivate editing

dvc.ReloadData();

// Switch updated entry elements to StringElements

dvc.Root = CreateEditableRoot(dvc.Root, false);

dvc.TableView.SetEditing (false, true);

AdvancedConfigEdit (dvc);


} );

}

RootElement CreateEditableRoot (RootElement root, bool editable)

{

    var rootElement = new RootElement("Todo list") {

new Section()

} ;

foreach (var element in root[0].Elements) {

if(element is StringElement) {

rootElement[0].Add(CreateEditableElement (element.Caption, (element as StringElement).Value, editable));

}  else {

rootElement[0].Add(CreateEditableElement (element.Caption, (element as StringElement /*I'M ADDING THIS */).Value, editable));

}

}

    return rootElement;

}

Element CreateEditableElement (string caption, string content, bool editable)

{

return new StringElement(caption, ()=>{new UIAlertView("","",null,"").Show();}); //I'M ALSO ADDING THIS


if (editable) {

return new EntryElement(caption, "todo", content);

}  else {

return new StringElement(caption, content); 

}


}



Juan M Gómez Álvarez


2012/11/5 Miguel de Icaza <[hidden email]>
Your approach would only work if you reload the entire tree (call CreateEditableCourts again, and replace the root with the new value).

Miguel

On Sun, Nov 4, 2012 at 10:56 AM, Juan Manuel Gómez Álvarez <[hidden email]> wrote:
Hello,

I´m using MonoTouch.Dialog to make an editable ViewTable like the Alarm app. I use two different Element, one when I don't edit (RadioElement) and another when I am in edit mode (StringElement).  

private RootElement CreateEditablCourts (bool editable=false)

{


var root = editable? new RootElement("Juzgados") : new RootElement("Juzgados",new RadioGroup(-1));

var section = new Section ();

var courts = lawerData.getAllCourts();

foreach (var c in courts) {

var court = c;

section.Add(CreateEditableElement(court.Location,editable));

}

root.Add(section);


return root;

}


private Element CreateEditableElement (string caption, bool editable = false)

{

if (editable) 

return new StringElement (caption, () => {

new UIAlertView ().Show ();}); //NEVER TRIGGER


var radioElement = new RadioElement(caption,string.Empty);

radioElement.Tapped+= () => {
new UIAlertView ().Show ();  //WORKS

} ;


return radioElement;


}


Thanks in advance,
_jmgomez_
Juan  M Gómez


_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch





_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|

UILabelView support links

BloomK
I want to have clickable links in test views (like a uilabel) but i don't want to use a heavy view like the web view cause it will be in a tableview. Or should i not worry about the heaviness? any ideas/suggestions?

Thanks,

Kris Bloom
--------------------------------
Extreme Velocity 3D
www.ExtremeVelocity3d.com



_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|

Re: UILabelView support links

Nic Wise
I think your choices are:

1. Use a webview. It's "heavy", but still - not too bad.
2. If you are fine with clicking the whole label, then do it that way,
but if it's just one word in a single label, you either need to use
attributed strings (to highlighted) then work out where the user
clicked, or put in [label no click] [label which can be clicked] [more
text] etc - and work out how to flow it. Which would be....
problematic.

I think I'd go with the webview and if you have problems, THEN try
something else :)

More info would be good tho !

On Wed, Nov 7, 2012 at 5:42 PM, Kris Bloom <[hidden email]> wrote:

> I want to have clickable links in test views (like a uilabel) but i don't
> want to use a heavy view like the web view cause it will be in a tableview.
> Or should i not worry about the heaviness? any ideas/suggestions?
>
> Thanks,
>
> Kris Bloom
> --------------------------------
> Extreme Velocity 3D
> www.ExtremeVelocity3d.com
>
>
>
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch
>



--
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|

Re: UILabelView support links

slodge
For clickable links, check out what Miguel does in some of the detail views:

http://tirania.org/tweetstation/screenshots.html

and

https://github.com/migueldeicaza/TweetStation
Reply | Threaded
Open this post in threaded view
|

Re: UILabelView support links

slodge
I think the main view where he draws and handles the clickable text blocks is: https://github.com/migueldeicaza/TweetStation/blob/master/TweetStation/UI/TweetView.cs
Reply | Threaded
Open this post in threaded view
|

Re: MonoTouch.Dialog Editable

krisha
In reply to this post by Miguel de Icaza-2
Hi,

I want to have me RadioElement(Child RootElement) of Parent RootElement Editable . I have gone through DemoAdvancedEditing but when i go back to app delegate page null exception is being thrown. Really need some help its urgent Than you
Reply | Threaded
Open this post in threaded view
|

Re: MonoTouch.Dialog Editable

Nic Wise
Are you able to post some code? (using a gist on github for example)

On 8 July 2013 07:38, krisha <[hidden email]> wrote:

> Hi,
>
> I want to have me RadioElement(Child RootElement) of Parent RootElement
> Editable . I have gone through DemoAdvancedEditing but when i go back to app
> delegate page null exception is being thrown. Really need some help its
> urgent Than you
>
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/MonoTouch-Dialog-Editable-tp4657601p4658370.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch



--
Nic Wise
t.  +44 7788 592 806 | @fastchicken
b. http://www.fastchicken.co.nz/
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch