Welcome, Guest. Please login or register.

Author Topic: MUI for dummies  (Read 5957 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline KronosTopic starter

  • Resident blue troll
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4017
    • Show only replies by Kronos
    • http://www.SteamDraw.de
MUI for dummies
« on: August 24, 2003, 11:14:47 AM »
I just started learning how to code for MUI, but ran into some probs about gadget-layout.

While I managed to fiddle most of it to look allmost like I wanted, it is the string-gadgets
that still give me a severe headache.

There 2 of them in a HGroup together with an selfmade BOOPSI-gagdets
(and no that ain't the prob here) which will be used to display the current cursor-pos
(this can be float-numbers so an integer-gadget wouldn't do).

The problem is that I can't get them to stay the right size. They are either spread all
over the window, or cramped into o9ne edge, when all I want them to do is to stay
on the right and just as big to display 6 chars (as long as possible).

MUIA_String_Maxlen seems to have no effect, and just forcing one width doesn't
seem right as you never know wether the user may prefer to use a font 50 pixels wide  ;-)

Any suggestions ?

Oh and expect this thread to go on as I only got the GUI showing up, but have yet to
find out how to connect that to the rest of the program  :-o  :-D
1. Make an announcment.
2. Wait a while.
3. Check if it can actually be done.
4. Wait for someone else to do it.
5. Start working on it while giving out hillarious progress-reports.
6. Deny that you have ever announced it
7. Blame someone else
 

  • Guest
Re: MUI for dummies
« Reply #1 on: August 24, 2003, 11:24:10 AM »
Grid it out on paper! :)

Work out where you need your "spacing" to go, and add "HSpace(0)" and "VSpace(0)" to the GUI init code.. this will basically fill in parts of the grid, the same way HTML table "colspan" etc. does.

Aaaanyway. Want to show us the code? It'd be easier to see any mistakes that way. You might be doing something obviously wrong.
 

Offline KronosTopic starter

  • Resident blue troll
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4017
    • Show only replies by Kronos
    • http://www.SteamDraw.de
Re: MUI for dummies
« Reply #2 on: August 24, 2003, 11:34:43 AM »
The code ? You want to see the code ? Believe me you can't handle the code ...... ;-)

The spaces aren't the prob here, but how to get the gadget to be just wide enough
to hold 6 chars of the given font. I would't mind a few extra pixels to cater for non-
proportinal fonts or so.


Filling in some HSpaces doesn't really help, as the gadgets still rezize like wild when
the window is resized.
1. Make an announcment.
2. Wait a while.
3. Check if it can actually be done.
4. Wait for someone else to do it.
5. Start working on it while giving out hillarious progress-reports.
6. Deny that you have ever announced it
7. Blame someone else
 

Offline blubbe

  • Sr. Member
  • ****
  • Join Date: Apr 2002
  • Posts: 268
    • Show only replies by blubbe
    • http://somewhere.in-hell.com
Re: MUI for dummies
« Reply #3 on: August 24, 2003, 11:44:23 AM »
It could possibly be solved by fiddling wtih
MUIA_Weight, weight

I havent been able to get stringgadgets to have
fixed size myself.

But as has been said, it would help to see the code.

Edit..

Try a combination of "MUIA_Weight, weight" for the
string(s) and Put RectangleObjects before/and/or/after the stringobject.

For example, to align a gadget to the right
HGroup,
Child, RectangleObject, MUIA_Weight, 75, End,
Child, StringObject,...,MUIA_Weight, 25, End,
End,


i      i     i    i   i  i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i  i   i    i     i     i      i
 

Offline KronosTopic starter

  • Resident blue troll
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4017
    • Show only replies by Kronos
    • http://www.SteamDraw.de
Re: MUI for dummies
« Reply #4 on: August 24, 2003, 11:58:04 AM »
"weight" doesn't help either as it will only result in the string-gadgets exploding on a big window,
or being cramped on smaller one.

Seems that I will have to force one size with MUIA_Width and MUIA_MaxWidth
based on the current font and change it whenever the font is changed ....
1. Make an announcment.
2. Wait a while.
3. Check if it can actually be done.
4. Wait for someone else to do it.
5. Start working on it while giving out hillarious progress-reports.
6. Deny that you have ever announced it
7. Blame someone else
 

Offline Gelb

  • Newbie
  • *
  • Join Date: Aug 2003
  • Posts: 24
    • Show only replies by Gelb
    • http://amigazeux.net
Re: MUI for dummies
« Reply #5 on: August 24, 2003, 12:07:04 PM »
You might want to use something like MUIA_FixWidthTxt , "123456"
...
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show only replies by itix
Re: MUI for dummies
« Reply #6 on: August 24, 2003, 12:13:48 PM »
Use tag MUIA_FixWidthTxt. For example

str = StringObject, MUIA_FixWidthTxt, "0000000", End;

Note 7 characters there: one is for cursor. And use characters which are wide by nature (read MUI_Area.doc and you understand why).
My Amigas: A500, Mac Mini and PowerBook
 

Offline KronosTopic starter

  • Resident blue troll
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4017
    • Show only replies by Kronos
    • http://www.SteamDraw.de
Re: MUI for dummies
« Reply #7 on: August 24, 2003, 12:21:15 PM »
Thanks, thats it .....

be prepared for round 2 to follow  :-P
1. Make an announcment.
2. Wait a while.
3. Check if it can actually be done.
4. Wait for someone else to do it.
5. Start working on it while giving out hillarious progress-reports.
6. Deny that you have ever announced it
7. Blame someone else
 

Offline GadgetMaster

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2177
    • Show only replies by GadgetMaster
Re: MUI for dummies
« Reply #8 on: August 24, 2003, 01:13:55 PM »
@itix

You seem to be very knowledgable with Amiga programming.

Do you program full time for the Amiga or is it just a hobby?

Just curious. :-)
 

Offline GadgetMaster

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2177
    • Show only replies by GadgetMaster
Re: MUI for dummies
« Reply #9 on: August 24, 2003, 01:17:21 PM »
Sorry OT

@Kronos

RE: your sig

Gimme the Prize - Kurgan's Theme from Queen's Album, A kind of magic, featuring the soundtrack from the first Highlander movie

Any prizes for getting that correct ??? :-P
 

Offline blubbe

  • Sr. Member
  • ****
  • Join Date: Apr 2002
  • Posts: 268
    • Show only replies by blubbe
    • http://somewhere.in-hell.com
Re: MUI for dummies
« Reply #10 on: August 24, 2003, 03:18:58 PM »
Ok, I have a problem getting images to work:

------------------
Child, ImageObject, MUIA_Background,      MUII_BACKGROUND,
MUIA_Image_Spec, '5:neversleep.gif', End,
-------------------

I get an empty gadget. Snoopdos reports nothing funny. (file is found and loaded with datatypes)
I have snipped away some other code  like a few gadgets (they work).

Should there be additional tags or something ?
i      i     i    i   i  i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i  i   i    i     i     i      i
 

Offline downix

  • Hero Member
  • *****
  • Join Date: Jan 2003
  • Posts: 1587
    • Show only replies by downix
    • http://www.applemonthly.com
Re: MUI for dummies
« Reply #11 on: August 24, 2003, 05:03:42 PM »
@Kronos

Actually Neko and I have been discussing co-writing a book for learning MUI.  If you'd like, can we pick your head on what areas need more clarity, and what not.
Try blazedmongers new Free Universal Computer kit, available with the GUI toolkit Your Own Universe, the popular IT edition, Extremely Reliable System for embedded work, Enhanced Database development and Wide Area Development system for telecommuting.
 

Offline GadgetMaster

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2177
    • Show only replies by GadgetMaster
Re: MUI for dummies
« Reply #12 on: August 24, 2003, 05:20:59 PM »
Quote

downix wrote:
@Kronos

Actually Neko and I have been discussing co-writing a book for learning MUI.  If you'd like, can we pick your head on what areas need more clarity, and what not.


How about publishing a few beginner tutorials here on Amiga.Org ?
 

Offline KronosTopic starter

  • Resident blue troll
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4017
    • Show only replies by Kronos
    • http://www.SteamDraw.de
Re: MUI for dummies
« Reply #13 on: August 24, 2003, 05:23:54 PM »
@Downix

Sounds nice, and here are some things I'm still stumbling on about:

How does the whole  notifying work, and how do I make my prog react on normal
events (other than gadgets).

How does one avoid getting an unresponsive GUI while the prog does something else.

How do I convert a normal Amiga-app with an event-loop into something MUI ?

Is there a save way to do draw into a window/MUI-object outside a Draw-event
(that just wouldn't be good for my proggy) ? And how does one create such a
object for personal use ?

I allready did a quick scan over the doku, and found hints for most of the probs, but help
on those is still much welcomed.


@Gadget
Prize ? Didn't you read ? I get the prize !!!  :-D
1. Make an announcment.
2. Wait a while.
3. Check if it can actually be done.
4. Wait for someone else to do it.
5. Start working on it while giving out hillarious progress-reports.
6. Deny that you have ever announced it
7. Blame someone else
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show only replies by itix
Re: MUI for dummies
« Reply #14 on: August 24, 2003, 06:51:54 PM »
Quote

Is there a save way to do draw into a window/MUI-object outside a Draw-event
(that just wouldn't be good for my proggy) ?


You can draw only inside MUIM_Draw because:

 - your object may belong to virtual group and needs clipping (MUI installs this automatically for MUIM_Draw)

 - your application can be hidden (in the iconified state) at anytime and thus _rp(obj) is not always valid.

 - your object could be hidden for some reason (page and register groups)
My Amigas: A500, Mac Mini and PowerBook