Setting listpicker to original list w/o the before picking handler

@ABG Any way to reduce it? I've just started to learn this type of coding this year. I'm taking AP Comp. Sci. so basically I'm a newb to this.

And you can upload blocks from their image on ai2... how? Magic?

There are techniques in some of the books in

namely Chapter 1 of
http://web.mit.edu/alexmv/6.037/sicp.pdf
but beware, that book is best eaten in small bites.

If you do the download right, like you did, without editting the image, you can drag the .png file into a Blocks Editor workspace and AI2 will use the hidden text in the file to recreate the blocks.

I save .png files of all my reusable procedures, by procedure name, to avoid having to recode them in other projects.

2 Likes

@ABG Wow. That's smart. I might do that for code for a universal theme.
And thanks for the pdf. You've been really helpful.

@ABG I was just going through the blocks for the listpickers and I saw this block
component_event.

  • Would the list be automatically be reset to the original list if put the setlist1.elements block in there every time I click on it?
  • And it wouldn't reset the list when it switches between lists like the list1.beforepicking event handler would do?

Thanks,

NetMinderNo.9Apps

I have never used this event.

I usually use the BeforePicking event to load Elements on the fly.

GotFocus()

Indicates the cursor moved over the ListPicker so it is now possible to click it.

This looks like it is intended for eye candy, to help the user see which component is currently under his finger and help him see if it is okay to click there. For such an event I would temporarily increase font size in that component.

1 Like

See here

I believe this block is a hangover from previous times also, and not functional in the way it works for a textbox

1 Like

Regarding the Before Picking event, this is most useful for cases when you need to change the available Elements depending on run time factors.

For example, say you sell clothing by mail.
Your order form has these list pickers:

  • Category (shoes/shirts/pants)
  • Material (leather/flannel/khaki/suede)
  • color (red/black/brown/white)
  • size (depends on item and stock availability)

As the customer Selects from each List Picker going down the list, you need to refill the Elements of each List Picker going down the list to reflect what you sell and what you still have in stock (i.e. size 13 brown leather shoes)

1 Like

@ABG and @TIMAI2. I'll look into this further, and big thanks for the helpful explanations.

@ABG and @TIMAI2, I could also put down a button and make the listpicker not visible. I could put a setlist1.elements block in it and a calllist1.open block after that. I think it would work in theory, as long as I make its image the one I'm using for the current listpicker, but I don't know for sure. What do you guys think?

Edit: Like this ↓ (the x is because it was a duplicate event handler)

Try it, and let us know if you got it to work.

1 Like

@ABG Both worked fine. I tried out the gotfocus component and the button, and both reset the listpicker to the first list. I am going with the button, just my preference. I haven't really worked with the got focus components yet, but i think they might come in handy for situations like these.

Do you know if the dev. are going to take it out? Because, as others have said,

and it might not be necessarily needed, since androids have updated past that point.

@TIMAI2 What do you think?

About what ?

About how i solved my problem. Which way would you use? And what is your opinion on it?

Sorry, I would not have started from there :wink:

2 Likes

Put a sample of your application here in the aia file. After testing, maybe some better solutions will emerge.
Without seeing what the application is doing, it's hard to give advice. I only saw that you are using list view to change application settings.

2 Likes

Regarding the GotFocus events, I have no news.
My guess is that it's harder politically to take away than to give, though there is a benefit to simplicity in its removal.

1 Like

@TIMAI2, @Patryk_F, @ABG Sorry for the late reply (I was taking a test). Here is the most current .aia file:
InTheNet.aia (36.6 KB)
Any better suggestions?

Thanks for your input!

@TIMAI2, @Patryk_F, and @ABG, Any suggestions for a better method to reset the list that I could actually do?

Sorry, you have exceeded my complexity limit.
In such circumstances, I start on documenting the app, with a Table of Contents.

P.S. I see you shoot off 3 file loads. How do you know when all 3 have finished loading?