topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday December 15, 2024, 3:47 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?  (Read 13707 times)

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,085
    • View Profile
    • Donate to Member
Hello,

Due to health reasons, I have not worked since March 2009, so I am expanding my development scope.  I want to try an experiment that I have in my mind and if it works might be marketable to municipalities.  Call it a "Living Map."  I can already see other different applications for this if I can get it to work.  I am not tied to any particular code.  If I need to I can use (learn) Python, .NET, Java, etc.  My best and most successful programming was/is in Visual Basic, so I could leverage that but it may not be the best for this application.

As you read these present requirements, please observe if you would anticipate any cautions against certain traps or hurdles a particular language (yours?) would present.  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 in your language?  

I have tried to make the above as clear as I could, but I realize there will probably be some questions... just ask.  I am not asking for "how" to do it, yet.  The math and logic are already congealing in my head.  I just need to know if these things are doable better or worse in the [Fill-in-the-Blank] language?  Just because it may be doable, doesn't mean I will have the skills to do it, but if I don't try, I'll never know.  

Thanks in advance for any input.

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,649
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #1 on: December 11, 2009, 06:01 PM »
Hm... Well the description of the behavior wanted seems clear enough, but what escapes me is the logic behind why it needed/wanted. Honestly the first thing that strikes me is there has got to be a better way of designing the interface.

Note: I'm from the start with the guts and work out school of thought e.g. top down design kills me... ;)

Can you elaborate on why large numbers of randomly grouped buttons are needed? ...Video game code (snippets & etc.) might be a good place to start on the how of this one.

As far as language goes, I'm a broken record for C++, but if you don't want to spend tons of time reasoning out the UI code C# might be better.

SingingBoyo

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 38
  • Java is awesome... C++ needs more libraries
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #2 on: December 11, 2009, 06:17 PM »
My vote would be Java... override a few paintComponent (or paint if you use AWT instead of Swing) methods, read a few tutorials for the more complex drag n' drop stuff, and you're off.
So you came along and found Java(insert programming language here)? Randomly?  Well then, you're just like me! Java fiends rule.  (Though other languages do have their uses.)

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,085
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #3 on: December 11, 2009, 08:43 PM »
Hm... Well the description of the behavior wanted seems clear enough, but what escapes me is the logic behind why it needed/wanted. Honestly the first thing that strikes me is there has got to be a better way of designing the interface.

Note: I'm from the start with the guts and work out school of thought e.g. top down design kills me... ;)

Can you elaborate on why large numbers of randomly grouped buttons are needed? ...Video game code (snippets & etc.) might be a good place to start on the how of this one.

As far as language goes, I'm a broken record for C++, but if you don't want to spend tons of time reasoning out the UI code C# might be better.

Sorry, I'm not the only one involved, you know... some of the NDA stuff.  ;)   As far as C++ is concerned, I have to become very productive very quick and I have tried C++ at least 5 times and could never "get it."  I'm glad (and admire) that you can!  Good to see you back in circulation.  Do you have your gloves on?
« Last Edit: January 01, 2011, 01:29 PM by CodeTRUCKER »

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,085
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #4 on: December 11, 2009, 08:50 PM »
My vote would be Java... override a few paintComponent (or paint if you use AWT instead of Swing) methods, read a few tutorials for the more complex drag n' drop stuff, and you're off.

Thanks SB - I appreciate the input.  Depending on the other opinions, I might try Java, but isn't it is a whole lot like C++?  
Still, given the Netbeans IDE is priced right, I could give that a serious "maybe."
« Last Edit: January 01, 2011, 01:30 PM by CodeTRUCKER »

SingingBoyo

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 38
  • Java is awesome... C++ needs more libraries
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #5 on: December 12, 2009, 12:25 AM »
I might try Java, but it is a whole lot like C++.  

Did I read that right?  Java is very different from C++.  Simpler, better tutorial, (Sun Java tutorial) and a massive graphics API that make GUI development easy...  C++ is a nightmare to understand, but Java is easier, and better documented.  Not to mention OS independant  :D

I'd suggest writing a couple simple GUI programs to get the hang of it before launching a full-sized project, but they can just be simple apps that take an hour or so to write
So you came along and found Java(insert programming language here)? Randomly?  Well then, you're just like me! Java fiends rule.  (Though other languages do have their uses.)

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,085
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #6 on: December 12, 2009, 12:35 AM »
I might try Java, but it is a whole lot like C++.  

Did I read that right?  Java is very different from C++.  Simpler, better tutorial, (Sun Java tutorial) and a massive graphics API that make GUI development easy...  C++ is a nightmare to understand, but Java is easier, and better documented.  Not to mention OS independant  :D

I'd suggest writing a couple simple GUI programs to get the hang of it before launching a full-sized project, but they can just be simple apps that take an hour or so to write

I apologize.  I was writing about my last real experience with Java ten years ago.  Not exactly a fair comparison, right?   Ok, I'll give it a fair chance and we'll see what comes up.  :)

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,649
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #7 on: December 12, 2009, 09:22 AM »
If I had to make a choice between Java & VB, I'd go with VB. I've never really seen a Java application that I liked, they always seem to be flaky, persnickety, and unstable. Sure I've used to for quickie bits on a web page, but I'd never try doing anything serious with it.

Seems to me that the only real "advantage" to Java is the one size fits all cross platform usage. However if being cross platform isn't an objective, then there is always a better way. This is for the same reason that a swiss army knife is a poor substitute for a proper tool kit. Sure it's handy for the type of quick fixes you can do while wearing a suit ... But don't try rebuilding an engine with one.

SingingBoyo

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 38
  • Java is awesome... C++ needs more libraries
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #8 on: December 15, 2009, 12:46 AM »
Seems to me that the only real "advantage" to Java is the one size fits all cross platform usage. However if being cross platform isn't an objective, then there is always a better way. This is for the same reason that a swiss army knife is a poor substitute for a proper tool kit. Sure it's handy for the type of quick fixes you can do while wearing a suit ... But don't try rebuilding an engine with one.

And RMI (big one for going easy on the sockets, though not necessary for this project), and easy graphics, a massive library that does just about anything, and CONSOLIDATED documentation!!!  I'll repeat myself...  CONSOLIDATED documentation.  There are many languages with good documentation, but I haven't found one yet with a complete tutorial that covers just about everything, with the exception of Java's excellent Sun Java Tutorial.  That was one of the biggest problems for me with C++, along with the sheer number of compilers out there - C++ has no tutorial that covers all the libraries out there, mainly because the C++ standard libraries are small, and most others are developed as open-source or compiler-specific. 

I don't know about VB, but I would hazard a guess that, being a microsoftism (nothing against Microsoft, great OS's, but the languages aren't very good IMO), has documentation without flexibility and while it apparently does graphics well, I doubt it has the sheer ability 'create-an-object-and-be-done-five-lines-later' that java has, and seems to be missing the button drag n' drop ability that you want, while I KNOW that somewhere, Java has a drag and drop interface for components, though I haven't been able to find it:P

And yes, I do realize I'm biased, spending 6 months straight of 4 hours a day when you are still in high school writing a java program will do that   :o
So you came along and found Java(insert programming language here)? Randomly?  Well then, you're just like me! Java fiends rule.  (Though other languages do have their uses.)

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #9 on: December 15, 2009, 01:17 AM »
Java is nice and all, but oh god the development environments I've tried (Eclipse and NetBeans) have their quirks - especially when it comes to GUI designers, which are quirky beyond reason... an the debuggers absolutely suck compared to what Visual Studio has. The refactoring support is nice, though, and possible because Java is so much simpler to parse than C++.

Since you've done VB, well, I'd say go for that - it's pretty darn fast to do GUIs in. Sounds like a somewhat weird thing you want to design, btw :)
- carpe noctem

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,085
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #10 on: December 15, 2009, 08:03 PM »
Java is nice and all, but oh god the development environments I've tried (Eclipse and NetBeans) have their quirks - especially when it comes to GUI designers, which are quirky beyond reason... an the debuggers absolutely suck compared to what Visual Studio has. The refactoring support is nice, though, and possible because Java is so much simpler to parse than C++.  

Since you've done VB, well, I'd say go for that - it's pretty darn fast to do GUIs in.

Thanks for the comments.  As it turns out, I was cleaning out a room and re-discovered a never-opened Visual Studio 2005 (Standard Ed.) prize I won for attending some MS webinars some time back, but I have been considering the trade-off of the quickness of production in a visual IDE versus the intimacy the coder gains with the textual-type syntax/logic  

Sounds like a somewhat weird thing you want to design, btw :)
Hmmmm...  that sounds like something that was probably said to Galilei, Leonardo, Thomas and Orville.   ;)
[/quote]
« Last Edit: January 01, 2011, 01:35 PM by CodeTRUCKER »

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,649
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #11 on: December 15, 2009, 09:55 PM »
I was cleaning out a room and re-discovered a never-opened Visual Studio 2005 (Standard Ed.)
Now I'm not per-se superstitious ... but that sounds an awful lot like a sign to me... ;)

...I use MSVS2005 on an almost daily basis, it's a fine IDE me thinks!

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #12 on: December 16, 2009, 09:39 AM »
but I have been considering the trade-off of the quickness of production in a visual IDE versus the intimacy the coder gains with the textual-type syntax/logic
Save the "real programming" for where it matters, not using visual designers for your GUI code is a waste of time... trust me. (I still do some of my GUI coding in raw Win32 API, so I know what I'm talking about :P)

Sounds like a somewhat weird thing you want to design, btw :)
Hmmmm...  that sounds like something that was probably said to Mr. Galilei, Leonardo, Thomas and Orville.   ;)
:-\ :-\ :-\
- carpe noctem

CWuestefeld

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,009
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #13 on: December 16, 2009, 02:00 PM »
This isn't actually a language question. It's a platform question. For example, the difficulty of doing this in C++ is wildly different depending on whether you're using Win32 API or MFC; when using Java, it differs much if you use Swing vs. SWT. And conversely, if you use .Net WinForms, the experience is the same whether you're using C# or VB.

The resizing of the button is probably trivial in any modern GUI platform. Your requirement to shift around other buttons is a somewhat larger challenge. If these aspects are your primary driver, then I'd focus on a GUI platform that offers some sort of layout manager. I know that such beasts exist for Java, and I've used them extensively under .Net's native WinForms classes. With .Net you get the language choice of C# or VB (and a few others).

Using the .Net WinForms layout managers, you can select from different layout strategies. There are a couple that might make good sense for you. One is the table layout, where you place objects just as you would in an HTML table, by assigning them to rows and columns. There's also a layout (unfortunately I forget the name) that flows your layout similar to the way HTML object (say, paragraphs with images in and around them) get shifted around, as when you resize your browser window.

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,085
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #14 on: December 16, 2009, 02:25 PM »
Save the "real programming" for where it matters, not using visual designers for your GUI code is a waste of time... trust me. (I still do some of my GUI coding in raw Win32 API, so I know what I'm talking about :P)
I agree there is nothing to be gained by reinventing the wheel.

:-\ :-\ :-\
Me too, but I won't know until I try.  :)

[Edit - Formatting.]
« Last Edit: December 17, 2009, 09:25 AM by CodeTRUCKER »

CodeTRUCKER

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,085
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #15 on: December 16, 2009, 02:27 PM »
This isn't actually a language question. It's a platform question.
...

Hey CWuestefeld, thanks for framing a context for me.  After some careful consideration of what I am actually trying to do, your comments and the above input I have to recognize that what I want to do and what I can do are too far apart at this time.  I might try it for NANY 2011, but with only two-weeks until my deadline, I would not be able to produce an alpha, much less a finished product.  I am going to put that project in the vault for the present.  I will see about reviving this thread (if necessary) in Q2/Q3 of next year. 

Everyone, I appreciate all the help!  You have kept me from beating my head against the wall unnecessarily.   

Ehtyar

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,237
    • View Profile
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #16 on: December 16, 2009, 06:38 PM »
MFC is dying a slow, agonizing death. If you're interested in using C++ w/ GUIs, consider trying wxWidgets or Qt. Both have excellent GUI designers and are cross-platform (which may or may not be a benefit).

C#/VB.NET have similar benefits though VS and Mono, though VB.NET bares little similarity to VB 6, and is often abandoned by more seasoned developers for the more logical (and some argue more powerful) syntax of C#.

Ehtyar.

PPLandry

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 702
    • View Profile
    • InfoQube Information manager
    • Read more about this member.
    • Donate to Member
Re: Can Buttons be Dynamically Moved, Resized, etc. in Your Language?
« Reply #17 on: February 26, 2010, 11:48 PM »
Ok, does that sound doable in your language?  

Way back in 1995, I was given a mandate by the National Reseach Council of Canada to do just that. It was called ScreenSurvey. Using VB (version 3 IIRC), there as a module to design forms with GUI elements (buttons, checkboxes, etc). Another module would run the admin-designed forms on a pre-defined schedule. Data entered by end-users (in those admin-designed forms) was stored on a network for later analysis.

It is still available on their web-site:
http://www.nrc-cnrc....k-performance.html#5

I still have the source code (but I don't own it)

IIRC correctly, VB supports control arrays (something that was dropped in VB.net). So simply create 1 instance of every VB GUI element, give it an index (it then becomes an array), set Visible=false and you're all set to create new controls using code.
Real generosity toward the future lies in giving all to the present -- Albert Camus -- www.InfoQube.biz
« Last Edit: February 26, 2010, 11:50 PM by PPLandry »