resize/divider bar

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

resize/divider bar

Post by mattmaier » Tue May 07, 2013 5:07 pm

I've found a couple references to the fact that you can create a divider bar, but all of them just kind of mention that you can do it without explaining how.

page 116 in the user guide
You can use the Geometry Manager to scale objects with a "divider" bar. Create and script the bar to move, then link the edges of the controls to it, then call revUpdateGeometry each time it moves to have the objects scale automatically
this lesson http://lessons.runrev.com/s/lessons/m/4 ... ry-Manager
You can use the Geometry Manager to scale objects with a divider bar. Link the edges of the controls to the divider bar, add a script in the divider to move in response to a mouse action, then call revUpdateGeometry each time it moves to have the objects scale automatically
I was able to stretch out a rectangular button to kind of look like a bar and use the geometry manager to make the two text fields and the "bar" maintain the appropriate place as the window resizes.

What I'd like to get is the same kind of divider bar that's in the dictionary (it's got horizontal and vertical bars). When you hover the mouse the cursor changes to that little double arrow thing that lets you know it's a divider bar. The one that looks like this Image

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: resize/divider bar

Post by bn » Tue May 07, 2013 7:17 pm

Matt,

have a look at the stack in this thread:
http://forums.runrev.com/phpBB2/viewtop ... =9&t=11224

is that what you mean?

Kind regards
Bernd

mattmaier
Posts: 109
Joined: Fri Apr 19, 2013 2:49 am

Re: resize/divider bar

Post by mattmaier » Wed May 08, 2013 5:43 pm

Hi Bernd,

Yeah, that's sort of what I was looking for. Thanks the link. I've spent a while going through the code in that stack and I learned a lot about the details. Like apparently there's a list of cursors. Who knew.

But is that a good way to do it? It looks like the three sections are just three rectangles and there's an awful lot of code necessary to figure out where the mouse is and which direction it's trying to drag. Like it's a totally custom solution that only works for that particular layout and then you get to start putting objects into the areas, which will be a whole 'nother thing.

Resize bars don't seem particularly unusual, and the documentation didn't suggest that including one would be as involved as that example. Livecode already has like 6 different kinds of text fields. Is there nothing built into it that's a little more straight forward and modular? Like a way to do it with objects that just get placed on the card same as everything else?

Maybe I can just reuse some of the code to respond to a little rectangle or button in between the two areas.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: resize/divider bar

Post by jacque » Wed May 08, 2013 7:53 pm

Livecode already has like 6 different kinds of text fields.
Nope. :) LiveCode has one single text field. The tools palette includes several "types" that are just the basic field with different properties pre-set so you have a shortcut when you want a field that behaves like that.

LiveCode also has one single button, and all those variations are just different property settings. The IDE obscures the fact by not providing all the available settings in the property inspector. But in the message box or a script you can easily transform a menu button into a push button, for example.

Ditto all the other controls -- there is only one of each kind.

The resize bar: I haven't looked at the example you mention but the script can be as simple as you need it to be. Put this script in the resizer bar:

Code: Select all

local sDoResize

on mousedown
  put true into sDoResize
end mousedown

on mouseup
  put false into sDoResize
end mouseUp

on mouseMove
  if sDoResize then
    put the mouseV into tPos
    get the rect of fld 1 -- field/group/whatever is on top
    put tPos into item 4 of it
    set the rect of fld 1 to it
    set the loc of me to item 1 of the loc of me,tPos
    get the rect of fld 2 -- whatever is under the resize bar
    put tPos into item 2 of it
    set the rect of fld 2 to it
  end if
end mouseMove
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply