From List to Canvas

Hi All,
Just started out coding my first MIDP game and stumbled on a problem.
To offer the user a choice I can use a List. I know what to do to create the list and handle its events. But after the list, I want to switch to a canvas to display the game in. Where I can not wrap my mind around is how I go from my list to the Canvas.
Can anyone help me, or is this too cryptic?
maik

If I understand what you mean, you can change from the form to the canvas by just adding another setCurrent() command, like this
Form myListForm = new Form("This is the form with the list in in it");
Canvas myCanvas = new GameCanvas(true);
getDisplay().setCurrent(myListForm);
// when the user selects from the list...
getDisplay().setCurrent(myCanvas);is that what you meant? Or did you mean how to you detect and handle the user selecting from the list?

Similar Messages

  • Continuing from using a canvas in tab item

    I asked about inserting a canvas into a tab item and ws given an answer which helped sort the problem , howvere i have hit another problem , the code is
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    namespace WPFDynamicTab
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
            private List<TabItem> _tabItems;
            private TabItem _tabAdd;
            private Canvas canvas1;
            public MainWindow()
               try
                    InitializeComponent();
                    // initialize tabItem array
                    _tabItems = new List<TabItem>();
                    // add a tabItem with + in header
                    _tabAdd = new TabItem();
                     canvas1= new Canvas();
                    _tabAdd.Header = "+";
                    _tabAdd.MouseLeftButtonUp += _tabAdd_MouseLeftButtonUp;
                    _tabItems.Add(_tabAdd);
                    this.AddTabItem();   // add first tab
                    // bind tab control
                    tabDynamic.DataContext = _tabItems;
                    tabDynamic.SelectedIndex = 0;
                catch (Exception ex)
                    MessageBox.Show(ex.Message);
            private TabItem AddTabItem()
                int count = _tabItems.Count;
                // create new tab item
                TabItem tab = new TabItem();
                tab.Header = string.Format("Tab {0}", count);
                tab.Name = string.Format("tab{0}", count);
                tab.HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate;
                // add controls to tab item, this case I added just a canvas
                Canvas canvas = new Canvas();
                canvas.Name = "canvas";
                Canvas canvas1 = new Canvas();
                canvas1.Name = "canvas1";
                // defining the background color of "canvas"
                switch (count)
                    case 0:
                        canvas.Background = Brushes.Green;
                        break;
                    case 1:
                        canvas.Background = Brushes.Red;
                        break;
                    case 2:
                        canvas.Background = Brushes.Blue;
                        break;
                    case 3:
                        canvas.Background = Brushes.Yellow;
                        break;
                    case 4:
                        canvas.Background = Brushes.Brown;
                        break;
                    case 5:
                        canvas.Background = Brushes.Orange;
                        break;
                    case 6:
                        canvas.Background = Brushes.Olive;
                        break;
                    default:
                        break;
                // Canvas_Paint defines the background color of  "canvas1"
    // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
            //    tab.Content = canvas;     // ORIGINAL (commented out) to populate tab.Content with canvas
                Canvas_Paint();
                tab.Content = canvas1;      //  NEW to populate tab.Content with canvas
    // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                // insert tab item right before the last (+) tab item
                _tabItems.Insert(count - 1, tab);
                return tab;
            private void _tabAdd_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
                TabItem newTab = this.AddTabItem();
                // clear tab control binding
                tabDynamic.DataContext = null;
                // bind tab control
                tabDynamic.DataContext = _tabItems;
                tabDynamic.SelectedItem = newTab;
            private void Canvas_Paint()
                int count = _tabItems.Count;
                switch (count)
                    case 0:
                        canvas1.Background = Brushes.Green;
                        break;
                    case 1:
                        canvas1.Background = Brushes.Red;
                        break;
                    case 2:
                        canvas1.Background = Brushes.Blue;
                        break;
                    case 3:
                        canvas1.Background = Brushes.Yellow;
                        break;
                    case 4:
                        canvas1.Background = Brushes.Brown;
                        break;
                    case 5:
                        canvas1.Background = Brushes.Orange;
                        break;
                    case 6:
                        canvas1.Background = Brushes.Olive;
                        break;
                    default:
                        break;
            private void tabDynamic_SelectionChanged(object sender, SelectionChangedEventArgs e)
    and the xml is
    <Window x:Class="WPFDynamicTab.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="Dynamic Tab" Height="300" Width="527" WindowStartupLocation="CenterScreen">
        <Grid>
            <TabControl Name="tabDynamic" ItemsSource="{Binding}" SelectionChanged="tabDynamic_SelectionChanged">
                <TabControl.Resources>
                    <DataTemplate x:Key="TabHeader" DataType="TabItem">
                        <DockPanel>
                            <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=TabItem }, Path=Header}" />
                        </DockPanel>
                    </DataTemplate>
                </TabControl.Resources>
            </TabControl>
        </Grid>
    </Window>
    The problem is when i use the Canvas "canvas" with the canvas pouplated within the method  all is ok  , however using "canvas1" where canvas1 is populated in Canvas_Paint 
    "canvas1" has null entries. How can I set the background colour in the tab using Canvas_Paint. Can the canvs be put in the XML? I hve simplified the problem from a much more complicated one in order to highlight the problem
    steve

    >>I asked about inserting a canvas into a tab item and ws given an answer which helped sort the problem , howvere i have hit another problem , the code is
    Please close your previous threads by marking helpful posts as answer before starting a new one. And please only ask one question per thread.
    >>How can I set the background colour in the tab using Canvas_Paint?
    You never set the Background of the canvas1 that you create in the AddTabItem() and use as the Content of the TabItem. Just remove this line from this method:
    Canvas canvas1 = new Canvas();
    ...and you will see the background:
    private TabItem AddTabItem()
    int count = _tabItems.Count;
    // create new tab item
    TabItem tab = new TabItem();
    tab.Header = string.Format("Tab {0}", count);
    tab.Name = string.Format("tab{0}", count);
    tab.HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate;
    // add controls to tab item, this case I added just a canvas
    Canvas canvas = new Canvas();
    canvas.Name = "canvas";
    canvas1.Name = "canvas1";
    // defining the background color of "canvas"
    switch (count)
    case 0:
    canvas.Background = Brushes.Green;
    break;
    case 1:
    canvas.Background = Brushes.Red;
    break;
    case 2:
    canvas.Background = Brushes.Blue;
    break;
    case 3:
    canvas.Background = Brushes.Yellow;
    break;
    case 4:
    canvas.Background = Brushes.Brown;
    break;
    case 5:
    canvas.Background = Brushes.Orange;
    break;
    case 6:
    canvas.Background = Brushes.Olive;
    break;
    default:
    break;
    // Canvas_Paint defines the background color of "canvas1"
    // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    //tab.Content = canvas; // ORIGINAL (commented out) to populate tab.Content with canvas
    Canvas_Paint();
    tab.Content = canvas1; // NEW to populate tab.Content with canvas
    // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    // insert tab item right before the last (+) tab item
    _tabItems.Insert(count - 1, tab);
    return tab;
    Another approach bay be to pass the Canvas element to the painted to the Canvas_Paint() method by reference instead of using a class-level field:
    Canvas_Paint(ref canvas1);
    tab.Content = canvas1;
    private void Canvas_Paint(ref Canvas canvas1)
    int count = _tabItems.Count;
    switch (count)
    case 0:
    canvas1.Background = Brushes.Green;
    break;
    case 1:
    canvas1.Background = Brushes.Red;
    break;
    case 2:
    canvas1.Background = Brushes.Blue;
    break;
    case 3:
    canvas1.Background = Brushes.Yellow;
    break;
    case 4:
    canvas1.Background = Brushes.Brown;
    break;
    case 5:
    canvas1.Background = Brushes.Orange;
    break;
    case 6:
    canvas1.Background = Brushes.Olive;
    break;
    default:
    break;
    Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.

  • Effect to image at drag start event from tilelist to canvas

    hello
    i just want to give effects to image at drag start event
    from tile list to canvas
    <mx:TileList dragEnabled="true"
    dragStart="moveeffect(event);">
    private function moveeffect(event:DragEvent):void{
    In this function how can i get image

    DragEvent has property called dragInitiator. That might help.
    Otherwise, you can add mouseDown event listener to your
    TileList and in that handler do something like:
    var initiator:UIComponent = UIComponent(event.currentTarget);
    and then add any effects to the initiator.
    ATTA

  • Facing difficulties in dragdrop event handler while moving images from tilelist to canvas

    1) my tile list contains images which are coming from
    database.
    2) i have to drag and drop those images from tile list to
    canvas.
    3) In tile list we don't have to write mouseMove event
    handler where we can define dragInitiator . (if dragEnabled = true)
    4) my dragEnter and dragOver is working properly . Problem is
    in dragDrop .
    5 ) how can i collect there dragged image
    (event.draggedsource.....what must be write)
    ERROR : Cannot access a property or method of a null object
    reference

    import java.util.Timer;
    import java.util.TimerTask;
    public class Test {
        public static void main (String[] args) {
            final Timer timer = new Timer ();
            System.out.println ("I'm gonna do something in 5 seconds.");
            timer.schedule (new TimerTask () {
                public void run () {
                    System.out.println ("Time's up !");
                    timer.cancel ();
            }, 5000);
    }if you want to display the time left it's better to make your own Thread that updates a "timeleft variable:
    {code}
    public class Test {
    //set the time Left to 3 mins.
    private long secondsLeft = 3 * 60;
    public Test () {
    new Thread (new Runnable () {
    public void run () {
    try {
    while (secondsLeft > 0) {
    //Let's update the timer every second.
    Thread.sleep (1000);
    secondsLeft = secondsLeft - 1;
    System.out.println ("Time left: " + (secondsLeft / 60) + ":" + (secondsLeft % 60));
    System.out.println ("Grats !");
    } catch (InterruptedException e) {}
    }).start ();
    public static void main (String[] args) {
    new Test ();
    {code}

  • Get column values from list of values programmatically

    hi all
    how i get column values from list of values programmatically in the
    returnPopupDataListener method

    If this answers your question , please close this thread by marking it as answered.
    Thanks

  • Downloads disappear from list immediately and automatically when download completed

    Everytime a download completes it disappears from list automatically

    Are you using Firefox 3.6 or Firefox 4?? Your "More system details..." link shows that you have turned off storing of history using a Firefox 4 preference (places.history.enabled), but your post says Firefox 3.6.17.
    Anyway, the general history setting affects not only site URLs, but also downloads. To treat them separately, go to
    Tools > Options > Privacy
    and change to Custom history settings. Does that solve it?

  • How to redirect from list edit form to another page using jquery in sharepoint 2013

    hi friends i have been trying to find a way to redirect from list edit form to another page using javascript and jquery
    i found lot of codes online but non of them are working for me.
    what i need is i have to save the data in the form and after that it has to redirect to another page. it has to get the url from hyperlink field of the item.
    please help me in this regards

    Not sure if you have gone through below links:
    http://spservices.codeplex.com/wikipage?title=%24().SPServices.SPRedirectWithID
    http://blogs.askcts.com/2013/02/18/using-spservices-and-jquery-to-perform-a-redirect-from-a-sharepoint-list-newform-to-editform/
    Please ensure that you mark a question as Answered once you receive a satisfactory response.

  • Add Option of choosing values from list in "Person Responsible" field of Cost Center Master

    Dear All,
    Could anyone advise me how can I add the option to Choose Values from list to field "Person Responsible",
    in Cost Center Master Data ?
    The Technical Name of this field is VERAK, and currently it is an open field.
    I would like to allow the user to choose values from existing list.
    Thank you!
    Orly

    Hi Orly,
    You have take it to your ABAPer, who will have to modify the attributes of CSKSZ-VERAK field in CSKSZ structure. ABAPer will have to define it with foreign key and introduce the name of the table, which will be used for deriving the available values. No standard table exists for it, but you can either create your own Z-table or take it from users table (USR02) if you have the necessary information there. Of course, this action would account for modification of standard SAP structure.
    Regards,
    Eli

  • JavaScript function which fetches return_value from List of Values

    Hi,
    I have created List of Values named "NICKS". I want to write JavaScript function "get_workers_fullname(nick)" which returns display_value from List of Values. The parameter of function is return_value of List "NICKS".
    I am new with this and don't know how to handle this case.
    Please help me.

    Hi,
    The LOV, I mean is the item in Application's Shared Components. I don't mean the visible SelectList on the page.
    This is what I found in ApEx's help: "A List of Values can be referenced by page items as well as report fields. It controls the values displayed and limits the user's selection. Lists of Values can be static (based on values you enter) or dynamic (based on a SQL query)."
    I'd like to access values in such LOV from JavaScript. I am not sure it is possible.
    Cheers,
    Tom.

  • How create temporary table from list of values

    Can you anybody advise me how can I create temporary table from list of values? I have list of values and need create temporary table for next use with command JOIN etc.
    Thank you for help

    NO, you can not create temporary table in oracle on the fly ( Like #Tabels in SQl Server or Sybase ) , you will have to use the GTT i.e Global Temporary Tables
    check the following link GTT :
    to flush the tables after commit
    CREATE GLOBAL TEMPORARY TABLE my_temp_table (
      column1  NUMBER,
      column2  NUMBER
    ) ON COMMIT DELETE ROWS;In contrast, the ON COMMIT PRESERVE ROWS clause indicates that rows should be preserved until the end of the session.
    so to keep rows in Table after commit
    CREATE GLOBAL TEMPORARY TABLE my_temp_table (
      column1  NUMBER,
      column2  NUMBER
    ) ON COMMIT PRESERVE ROWS;

  • Calling function from list of values section?

    can i call a function from list of values(LOV) section as well? I know we can sql query but udf is supported?

    See this recent thread: Display as Text (LOV) or join
    Scott

  • How can I permanently delete an old phone number from my 'receive iMessage from' list?

    I have just got a new contract and iPhone. I wanted to get rid of my old number because of people hassling me on it. However I can still receive iMessages through my old number even though I have a brand new phone and SIM card! I have de-selected it on the 'receive from' list, but I want to permanently delete the number for a fresh start. I have logged into my icloud account on apple but as I didn't actually register the previous device with apple there seems to be no option to remove it. can anyone help? Why can I not just swipe and delete this number!!! Ridiculous! So much for a fresh start   just turning the option off isn't the same.

    See Apple Support article TS5185. Note that although the problem that article concerns doesn't apply to you, the solution it describes does.

  • How to add anchor tag dynamically on infopath (OOTB task form of workflow .xsn) by jquery -dynamically as i did by below script on newform.aspx where I will read Help title and URL value from list

    on newform.aspx just above the top of cancel button I want to put 1 hyperlink "Help"
    but I want to do this by script/jquery by reading my configuration list where 1 column is TITLE and other is- URL
    Configuration List has 2 columns Title and URLValue
    Title                                    UrlValue
    HelpNewPage                    
    http://url1
    HelpEditPage                      http://url2
    so script should read Title and display "Help"--->1st part on NewForm.aspx/EditForm
    Script should read UrlValue column and on click of help-(display link) the respective url should be open in new window.-->second part
    Please let me know reference code for adding anchor tag dynamically by reading from list
    Help/Reference 
    http://www.sharepointhillbilly.com/Lists/Posts/Post.aspx?ID=5
    I can see hyperlink near cancel button-
    //This block is just placing help link near cancel button- 
    $(document).ready(function() {
        GetHelpLinkFromConfigList();
    var HelpLinkhtml ='<a href="#" text="Help">Help</a>';
    var position =$("input[value='Cancel']").parent("td").addClass('ms-separator').append(HelpLinkhtml);
    var HelpLinkhtml ='<a href="#" text="Help" onclick="GetHelpLinkFromConfigList();">Help</a>'; 
    var position =$("input[value='Cancel']").parent("td").addClass('ms-separator').append(HelpLinkhtml);
    var HelpLinkimageButton ='<IMG SRC="../../Style Library/Help.bmp" style="width:35px;"/>'; 
    var position1 =$("input[value='Cancel']").parent("td").addClass('ms-separator').append(HelpLinkimageButton );
    //Rest script
    function GetHelpLinkFromConfigList()
     //The Web Service method we are calling, to read list items we use 'GetListItems'
     var method = "GetListItems";
     //The display name of the list we are reading data from
     var list = "configurationList";
     //We need to identify the fields we want to return. In this instance, we want the Title,Value fields
     //from the Configuration List. You can see here that we are using the internal field names.
     var fieldsToRead = "<ViewFields>"+"<FieldRef Name='Title' />"+"<FieldRef Name='Value' />"+"</ViewFields>";
     //comment
     var query = "<Query>" +
                            "<Where>" +
                                "<Neq>" +
                                    "<FieldRef Name='Title'/><Value Type='Text'>Help</Value>"
    +
                                "</Neq>" +
                            "</Where>" +
                            "<OrderBy>" +
                                "<FieldRef Name='Title'/>" +
                            "</OrderBy>" +
                        "</Query>";
     $().SPServices(
     operation: method,
        async: false,
        listName: list,
        CAMLViewFields: fieldsToRead,
        CAMLQuery: query,
        completefunc: function (xData, Status) {
        $(xData.responseXML).SPFilterNode("z:row").each(function() {
        var displayname = ($(this).attr("ows_Title"));
        var UrlValue = ($(this).attr("ows_Value")).split(",")[0];
        AddRowToSharepointTable(displayname,UrlValue)
    function AddRowToSharepointTable(displayname,UrlValue)
        $("#NDRTable").append("<tr align='Middle'>" +
                                    "<td><a href='" +UrlValue+ "'>+displayname+</a></td>"
    +
                                   "</tr>");
    <table id="NDRTable"></table>
    sudhanshu sharma Do good and cast it into river :)

    Hi,
    From your description, you want to add a help link(read data from other list) into new form page.
    The following code for your reference:
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    ExecuteOrDelayUntilScriptLoaded(AddHelpLink, "sp.js");
    function AddHelpLink() {
    var context = new SP.ClientContext.get_current();
    var list= context.get_web().get_lists().getByTitle("configurationList");
    var camlQuery= new SP.CamlQuery();
    camlQuery.set_viewXml("<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>Help</Value></Eq></Where></Query></View>");
    this.listItems = list.getItems(camlQuery);
    context.load(this.listItems,'Include(Title,URL)');
    context.executeQueryAsync(function(){
    var ListEnumerator = listItems.getEnumerator();
    while(ListEnumerator.moveNext())
    var currentItem = ListEnumerator.get_current();
    var title=currentItem.get_item("Title");
    var url=currentItem.get_item("URL").get_url();
    var HelpLinkhtml ='<a href="'+url+'">'+title+'</a>';
    $("input[value='Cancel']").parent("td").addClass('ms-separator').append(HelpLinkhtml);
    },function(sender,args){
    alert(args.get_message());
    </script>
    Result:
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Event Receiver to get folder Names from List View Web Part

    Hi,
    We have a requirement i.e.
    On one of the page,there are some folders on the list view web part.
    Now through event receiver i should pick the folder names from list view web part and
    update the same in the list.
    If that names already exists in the list then we should leave without updating,if not we have to add folder name in the list.
    Please share your ideas regarding the same.
    Regards,
    Naga Sudheer M
    Thanks & Regards, Sudheer

    Hello,
    LVWP is just for displaying content of site so you need to associate your event receiver with actual list/library. You can create ItemAdded event receiver to check existing folder and create new if not existing. "sk2014" links are good to start.
    http://sharepoint.stackexchange.com/questions/59788/change-name-in-itemadding-event-receiver-or-create-a-new-item
    Let us know in case any doubt
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Can we get the data from list without using any change event...

    It is possible to get the current data from list without passing events?...
    Thanks in advance,
    senthil.

    Can you get what you want by accessing the selectedItem/selectedItems and selectedIndex/selectedIndices properties?

Maybe you are looking for

  • Video Problem with 26AV502R

    I have a TV that was working fine for a about a year or two till one day vertical lines started to fade onto the screen. It was after some power outages. I found that it is related to the colors on the screen and that it will form where light colors

  • Can we use overload and overwrite concept in OO-abap

    hi can we use overload and overwrite concept in OO-abap

  • DV6-6000 LF372AV - Fails BIOS recovery

    I have a DV6-6000 Prod #LF372AV where the BIOS became corrupted.  Didn't attempt update, just failed out of the blue. First symptom is turn on PC, hear fan come on then immediately reboots.  Stuck in this cycle of rebooting forever.  With no error co

  • How to give if condition in XSLT for the below issue

    I have a customer order in .Txt which is picked by my FTP process & in mediator mapping will be done. Here i have an issue where the Txt file is in delimiter file it is having Customer Order number(CON) in each line of a single record,now i have to i

  • ERM mass role import

    Hello colleagues! I have got new problem during transporting roles via templates. I put content of my role in txt and 2 xls files. After clicking on Foreground button I have got message: "Role not imported; unable to determine matching org. level for