Welcome, Guest. Please login or register.

Author Topic: I'm such a gadtool  (Read 2701 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline peroxidechickenTopic starter

  • Full Member
  • ***
  • Join Date: Apr 2002
  • Posts: 170
    • Show only replies by peroxidechicken
I'm such a gadtool
« on: June 24, 2003, 09:47:15 AM »
Could someone take me through the steps leading up to and resulting in a successful Createcontext() call in assembler?  

I've read the RKMs - on more than one occasion - regarding gadgets and this particular function and I'm just not getting it.  I've even tried using monam to step through the wb3.1 calculator program - it ain't pretty...  
H2O2
 

Offline xeron

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 2533
    • Show only replies by xeron
    • http://www.petergordon.org.uk
Re: I'm such a gadtool
« Reply #1 on: June 24, 2003, 10:06:10 AM »
Well, I can't right now because I'm at work, but when I get home I can give you some example source on how to do a full font and screen sensitive Gadtools GUI in assembler, if you like.
Playstation Network ID: xeron6
 

Offline Thomas

Re: I'm such a gadtool
« Reply #2 on: June 27, 2003, 09:47:06 PM »

What is so difficult about it ?

move.l   GadToolsBase,A6
lea.l   glist,A0
jsr   LVOCreateContext(A6)
move.l   D0,gadget
...
dc.l   glist   ; the gadget list given to OpenWindow()
dc.l   gadget   ; the gadget pointer given to and returned by CreateGadget()

Bye,
Thomas

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: I'm such a gadtool
« Reply #3 on: June 27, 2003, 09:56:57 PM »
Quote
What is so difficult about it ?

Dunno. Something is, because your code below is bogus. :-)

Quote

move.l GadToolsBase,A6
lea.l glist,A0
jsr LVOCreateContext(A6)
move.l D0,gadget
...
dc.l glist ; the gadget list given to OpenWindow()

You mean:

glist: dc.l 0
Quote

dc.l gadget ; the gadget pointer given to and returned by CreateGadget()

You mean:

gadget: dc.l 0
 

Offline peroxidechickenTopic starter

  • Full Member
  • ***
  • Join Date: Apr 2002
  • Posts: 170
    • Show only replies by peroxidechicken
Re: I'm such a gadtool
« Reply #4 on: June 27, 2003, 11:40:19 PM »
As I said (somewhere) before, I didn't find the function description of CreateContext() to be very useful.  But you guys have revealed some extra clues so I should be able to get on with it - thankyou very much.  

Thomas (regarding another thread I started) - Maybe, out of all Amigas it's just mine that has weird zooming windows but...  Startup the calculator program, move the window, click the zoom gadget and tell me what happens next.  And don't get me wrong, I appreciate your feedback.  
H2O2
 

Offline Thomas

Re: I'm such a gadtool
« Reply #5 on: June 28, 2003, 08:37:25 AM »

Of course I meant glist: dc.l 0 or glist: ds.l 1. It's a long time since I wrote assembler and I was quite tired yesterday.

CreateContext just allocates a dummy Gadget for you to start the Gadget chain. It puts the pointer into both, gad and glist (talking about gad as the return value in register D0). You then use gad as the "previous gadget" pointer in NewGadget. NewGadget will put the new gadget's pointer into gad->NextGadget and return it so you can use it again as "previous gadget" pointer in the next NewGadget call.

In the end you have in gad the pointer to the gadget created by the last NewGadget call (which is for no use from now on) and in glist a pointer to the first gadget which you can use in OpenWindow or AddGList. You also give the glist pointer to FreeGadgets in the end.

Regarding the calculator, it does exactly what you described and it is usual behaviour. I will explain again, why:

The zoom gadget exchanges the current window coordinates and an internaly stored alternate set of coordinates. The initial alternate coordinates are set during OpenWindow. If the application does not set the alternate coordinates, they will match the window's coordinates.

Calculator does not give alternate coordinates. So open Calculator and press the zoom gadget: nothing happens. Move or resize the window, then press zoom: Calculator moves and sizes to the old position. Press zoom again: Calculator returns to the new position.

Now let's take Workbench. Workbench gives its drawers alternate positions when opening. Open Ram Disk and press zoom. It will become a small window in the top left edge. Press zoom again and it will return to the initial size.

Another example is the shell window. When zoom pressed for the first time, the window will fill the whole screen. But move and resize the zoomed window and pressing the zoom gadget will swap between two sizes and positions.

That's how it is documented and how it works. People will probably hate you if you change this behaviour. The Windows' way of doing things is not the only one.

Perhaps it might be interesting to patch OpenWindow to check whether alternate coordinates are given and if not to supply some (probably filling the screen). This might improve Calculator's behaviour. But zooming Calculator does not make sense in my opinion. It just zooms the buttons. I never felt the need to resize the calculator window.

Bye,
Thomas

Offline peroxidechickenTopic starter

  • Full Member
  • ***
  • Join Date: Apr 2002
  • Posts: 170
    • Show only replies by peroxidechicken
Re: I'm such a gadtool
« Reply #6 on: June 29, 2003, 12:07:09 AM »
So it's not just me - great!   :-)  And thanks for the reply.  

As for windows (in workbench), I know that the window structure should just be accepted as documented but finding those zoom coordinate fields and messing around with them was much more fun than getting nowhere with gadgets.  Before I stopped playing with it, I had it 'rigged' so that successive clicks on the zoom gadget toggled between 3 (or more) window sizes - collapse to title bar, larger than normat, back to normal.  Although, I never thought of preserving the top-left coord and width as the Windows (TM *) way of doing things...   :-)

Thanks again for the help.  

* Tyranny Mark
H2O2