benjie-git / CardStock

CardStock is a cross-platform tool for quickly and easily building programs. It provides a drawing-program-like editor for visually laying out your programs' parts, and a code editor for adding event-driven python code.
Mozilla Public License 2.0
249 stars 9 forks source link

Missing functionality? Clickline? Backgrounds? Shared Text fields #19

Open everythingability opened 4 days ago

everythingability commented 4 days ago

While trying out Cardstock I notice a lot of the feaures of HyperCard that are missing...

OR I haven't rejigged my brain from gode ole HyperTalk into Python maybe? Dunno...

I mean it was a long time ago, but one of the things I did a lot with HyperCard was use it to create sort of "Note" collections and I would have a non-editable text field (on the background) and create a button to prompt for a card name, which then created that card, and then the code in the scrollable text field, when clicked would get the clicked line, pickup the text of that line and go to that card.

This way I could create a sort of indexed notepad...

From what I can see, the methods clickedLine, or get text of line field_1.clickedLine of field_1 doesn't really sort of exist in CardStock yet do they?

And also, there is no backgrounds are they? And so no "Shared text fields" to sort of remain on each background.

NOW I'M NOT SAYING that you should slavishly follow the make up and design of HyperCard, but there are some bits I think are worth not losing... which might include...

benjie-git commented 3 days ago

Great ideas, thank you!

• I love your point about getting text position of TextField clicks. I'm a little hesitant to just default to adding more event handlers, since a big goal of CardStock is simplicity and low barrier to entry. But maybe a good way to accomplish this would be a method on TextFields that converts a mouse position into a (line,position) tuple, with the idea that you could use this easily from inside an on_mouse_press(mouse_pos). I also realize that I should update TextField.selection to include line information instead of just a single character position value each for start and end positions of the current selection.

• I'll leave comments on the paint/canvas ideas on your previous issue.

• I completely agree on the collection of icons. I added integration with openclipart.org, but it's only an OK resource. I'd love to include a curated collection of icons to allow using in buttons, etc. But I'd need to find someone to help curate that collection. That's not a skill within my core competencies, as it were.

• I agree that it would be nice to allow buttons to have full color control. I held back on that due to thinking that maybe instead I should merge Rectangles, Round Rectangels, and Buttons into one object type. The downside would be that then I don't know where to fit in Radio and Checkbox buttons. Do you have thoughts on any of that?

everythingability commented 2 days ago

Re: ClickLine: For the, the simplicity comes from the type ahead method suggestions. I guess it needs saying that a field also needs a text is selectable feature (so it can accept a click and hilite that line). I don't want to stress this too much. Maybe there's another way to do this, but the old HyperCard way worked well enough. i.e When you create a new card (with this button -> ask the card name, name the card, add that to a list of card (or go get the names of all the cards) and set the text of an indexListing field that can workout what line/text was clicked and then go to that line.

I guess it perhaps calls for a separate list object - which could be like a locked/clickable scroll text, or maybe a dropdown...tabs? That sort of thing.

Re: Paint canvas: I see you've looked at this elsewhere. My obvious use cases for the drawing areas are.

Re: Curated icons. Yeah. This is a tough one. The open clip art imo is a bit er, naff... In my head, I quite like the aesthetic of Susan Kare's stuff, in part because they're cohesive (whereas the open clip art is the opposite). Again, whilst wanting to ape what was great about HyperCard, it'd be daft to slavishly follow HyperCard, and maybe miss massive opportunities. For example, one might use spritesheets (something that are out there) or themes, or even sort of formulas for building components somehow. You might do a "deal" with the NounProject or similar? Maybe making this REALLY easy to extend so that someone like this https://egardepe.itch.io/hypercardgraphics might make a theme or collection like these https://itch.io/game-assets/free/tag-black-and-white or some such?

Incidentally, I "made" a HyperCard-like dithering app on websim. You're welcome to rip that off. When you import a pic, there could be a checkbox to go old skool maybe.

Re: Full color and button styling: The standard interface-ness of the radio/checkbox buttons suffer from not inheriting more properties, for example, I'd like to make the fontsize of all my radio buttons to be much bigger.

Once I discovered I could use a round rect, and group a text with it... to make a button, with text, with a nice fat border in yellow and purple, I realised I could kind of fake my way to what I wanted.

Sorry, banged on a bit. Great work. One last thing though... For me, the mistake most HyperCard clones make is sticking to the original too much... and not sort of continuing the work of Bill Atkinson, and sort of saying "What would would a HyperCard-ish software erector kit be today?". HyperCard never really handled HyperText, as in clickable links, and yet they came along and took over the world.... We have so many new concepts "just lying around" like authentication, APIs... type-ahead scrolling... touch support... desktop notiifcations, sending email even.

Did you ever play with RunRev's Revolution? It had some newer features, but got bogged down in them I think. They had sort of Groups which could behave like backgrounds, and whilst it was more powerful than HyperCard's backgrounds, they had odd side effects that I could never figure out. I used to use Revolution with students about 10 years ago to make Heritage museum / game things... and even then the verbosity of HyperTalk would at times piss me off - when simplicity becomes too complicated to deal with. :-)

everythingability commented 2 days ago
image

Ah. On the subject of openclip art, I don't think it works in the web editor. I searched for "tree" and got...

image
benjie-git commented 2 days ago

This is an openclipart bug, where a search will return a bunch of pages of results, and the first few pages are blank. If you click '>>' a few times, you'll start to see results. Obviously this is not great. Maybe I could at least add in some messaging explaining this. I was planning to build a custom interface to openclipart, but was not sure I actually wanted to stick with that provider.

benjie-git commented 4 hours ago

On the click line issue. I added text field methods to allow your use case:

  i = text_field.point_to_index(pt)
  pt = text_field.index_to_point(i)
  (r, c) = text_field.index_to_row_col(i)
  i = text_field.row_col_to_index(r, c)

so in an on_mouse_release handler, you could, for example:

on_mouse_release(mouse_pos):
  i = self.point_to_index(mouse_pos)  # get the index of the character clicked
  r,c = self.index_to_row_col(i)  # convert index to row (line number) and column (char index on that line)
  # then set the selection to go from the beginning of the clicked row, to the end of that row (one less than the index of the start of the next row)
  self.selection = (self.row_col_to_index(r,0), self.row_col_to_index(r+1,0)-1)

I hope this will allow you to build what you were aiming for!

Note that this is available in git, but not in a release yet, and is not up and running on the web version yet.