May 04, 2024, 04:57:05 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Dynamic Button Creation, Placement and Resizing in real time.

Started by CodeTRUCKER, December 10, 2009, 08:59:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

CodeTRUCKER

Hello,

I want to try a crazy experiment (call it a 'wild hare') that I have dreamed up.  As strange as it may seem, I can already see three different applications for this if I can get it to work.  One of them is a "Living Map."  It will use a main form with a sidebar.  Here are some particulars...


  • It will have a main form with a sidebar/corner-block.
  • There will be a stationary button on the sidebar/corner-block that the I can drag to the main form, drop and resize to my whim.  This would be just like dragging a control (button) to the form at design time.
  • This will be done as many times as I want to do so, anywhere from 2-100+ times.
  • If I drop it on the form on top of another existing button(s), I need to have the existing buttons make room for the new one.  This would require the existing buttons to...

    • Detect the new button was dropped.
    • The existing buttons would have to be recalculated and placed around the newly dropped button.
    • Allow any button to be dragged/dropped to anywhere on the form.

      • I guess I would also want a toggle/checkbox/radio-buttons to select if I wanted to have the button I am dragging to dynamically resize or to have all other buttons shrink/grow to make room for the button I am dragging.

      • It would be necessary to have each button "remember" their size because once the dragged button passes the existing buttons each button could return to its last established dimension, but...
      • ... if the dragged button's placement encroaches on the existing buttons it will be necessary for the surrounding buttons to assume new dimensions.
  • I also want to display text in different areas of the button, i.e., to dynamically display the dimensions of the button in pixels(?).
  • As a last option, I would want all the buttons to scale to fill the entire form without changing their relative position or the "aspect ratio" of the "view."

Ok, does that sound doable?  

Don't get me wrong, I am not asking for "how" to do it.  The math and logic is already congealing in my head, if I am not starting with wrong premises.  I just need to know if these things are doable in EB?  

Thanks in advance for any input.
Calvin
Calvin Waterbury


Truth, unlike opinion, tradition, etc. will always be able to stand on its own.  Truth is not a static, but a living entity and will perpetually impart life; therefore, any "truth" that does not or can not impart life can not be Truth.

LarryMc

December 10, 2009, 10:47:02 PM #1 Last Edit: December 10, 2009, 10:51:47 PM by Larry McCaughn
My answer would be absolutely yes, it is doable.

I personally wouldn't want to tackle it(only because I can't see a need for it -no first hand application in mind).

It would probably help you to purchase Paul's EB Beta Designer which would show how to manage multiple dynamically created buttons and do almost all the things you are describing.

There's code in the forms on dragging and dropping.
There's code with multiple windows and multiple controls and the resizing of both.

I'm not sure I understand "I also want to display text in different areas of the button, i.e., to dynamically display the dimensions of the button in pixels(?)."
Changing text on the fly in a button is a no-brainer as well as the font and size.
Placing text in different locations within a button can be simple(left,center,right align) or it can be that you would need to subclass the button and draw your own text.

My custom button library will allow you to offset text left or right or up or down from center real time by x-number of pixels.  But without knowing more about what exactly you are wanting to do I can't say if it's a fit for your needs.

So the bottom line, in my opinion, is that if you can dream it up you can do it in EB.

You might want to be reading up on how EB handles oop also.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

mrainey

Larry,

I remember you having some anti-aliasing discussions with Ficko.  Did you ever incorporate anti-aliasing into your button library?  The "jaggies" were the only thing that kept me from buying and using it.
Software For Metalworking
http://closetolerancesoftware.com

LarryMc

Mike,

I used anti-aliasing in the chart library which I worked on after the button library.

Maybe I need to put "revisiting the button designer" on my list of things to do.
Right now I don't know how well regions and anti-aliasing work together.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library