English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. Blitz Basic (http://eab.abime.net/forumdisplay.php?f=126)
-   -   Blitz Basic 2.1 - Window command (http://eab.abime.net/showthread.php?t=105573)

JJ__ 28 January 2021 22:04

Blitz Basic 2.1 - Window command
 
Hi All,

Does anyone have a list of all the FLAGS for the WINDOW command anywhere they could share please? I'm using workbench 3, but not sure if that makes a difference.

Also, does anyone know how to create a scroll gadget in the WINDOW command, or via another BB2 command?

Thanks in advance.

Daedalus 30 January 2021 00:28

Good questions. I might suggest though that a better place for them might be the Blitz Basic subforum that you can find here. Maybe a mod can move this thread?

Now, the thing about the flags field is that it's not Blitz-specific, but the Blitz documentation doesn't really tell you that. It gives you a list of values you can use in the manual (which is available in AmigaGuide format on Aminet, and online here, with the specific page listing the flags here), which will work fine, but Amiga OS itself defines these values and provides names for them to make them easier to work with. Blitz supports these constants too, but the manual doesn't really explain how you can use them.

To use the OS constants (which includes constants introduced since Blitz was released), you need to refer to the Amiga Developer Docs, and in particular, the intuition header file which defines all the flags. Do a search for values beginning with WFLG_ and you'll see all the possible values, and the OpenWindow() documentation for detailed descriptions of each flag.

Using these flags in Blitz means adding a resident file to the compiler settings. These are more or less the same thing as header files in C like I linked to above, but they're precompiled. You can add them to your program by opening the compiler settings and adding blitzlibs:amigalibs.res to the residents list. Once that's done, the flags will be available for use. They're called the same as the OS documentation lists them, but in Blitz, they need a # symbol before the name to denote a constant. With this resident enabled, you can open a window like this:

Code:

Window 0, 100, 100, 200, 100, #WFLG_DRAGBAR|#WFLG_DEPTHGADGET|#WFLG_CLOSEGADGET|#WFLG_ACTIVATE, "Test Window", 1, 2
If the line ends up too long for the editor, you can add the values together, store in a variable, and use that variable in the Window command instead. Make sure the variable is a Long type.

Now, scrollbars for windows aren't a simple thing, and unlike many OS features, Blitz doesn't offer any convenient shortcuts. As a result, you need to do it manually, which needs several steps. There's a lot involved, and I'm not 100% up to snuff on it myself, but the basics are that you need to create scrollbars yourself using Intuition gadgets, then attach them to the window borders using special flag values. You also need to adjust the maximum and visible values of the scrollbar so it keeps in proportion with whatever you're showing.

Coagulus 30 January 2021 01:13

I'm sure I remember one of the Blitz examples had a superbitmap window with a scroll gadget but I could be wrong.

Daedalus 30 January 2021 18:55

Yeah, that seems vaguely familiar to me too, but I couldn't find it yesterday when I looked for it. It may be buried in an issue of BUM, or be on Aminet or something like that. Would be good to have!

JJ__ 18 February 2021 11:21

Quote:

Originally Posted by Daedalus (Post 1457546)
Good questions. I might suggest though that a better place for them might be the Blitz Basic subforum that you can find here. Maybe a mod can move this thread?

Now, the thing about the flags field is that it's not Blitz-specific, but the Blitz documentation doesn't really tell you that. It gives you a list of values you can use in the manual (which is available in AmigaGuide format on Aminet, and online here, with the specific page listing the flags here), which will work fine, but Amiga OS itself defines these values and provides names for them to make them easier to work with. Blitz supports these constants too, but the manual doesn't really explain how you can use them.

To use the OS constants (which includes constants introduced since Blitz was released), you need to refer to the Amiga Developer Docs, and in particular, the intuition header file which defines all the flags. Do a search for values beginning with WFLG_ and you'll see all the possible values, and the OpenWindow() documentation for detailed descriptions of each flag.

Using these flags in Blitz means adding a resident file to the compiler settings. These are more or less the same thing as header files in C like I linked to above, but they're precompiled. You can add them to your program by opening the compiler settings and adding blitzlibs:amigalibs.res to the residents list. Once that's done, the flags will be available for use. They're called the same as the OS documentation lists them, but in Blitz, they need a # symbol before the name to denote a constant. With this resident enabled, you can open a window like this:

Code:

Window 0, 100, 100, 200, 100, #WFLG_DRAGBAR|#WFLG_DEPTHGADGET|#WFLG_CLOSEGADGET|#WFLG_ACTIVATE, "Test Window", 1, 2
If the line ends up too long for the editor, you can add the values together, store in a variable, and use that variable in the Window command instead. Make sure the variable is a Long type.

Now, scrollbars for windows aren't a simple thing, and unlike many OS features, Blitz doesn't offer any convenient shortcuts. As a result, you need to do it manually, which needs several steps. There's a lot involved, and I'm not 100% up to snuff on it myself, but the basics are that you need to create scrollbars yourself using Intuition gadgets, then attach them to the window borders using special flag values. You also need to adjust the maximum and visible values of the scrollbar so it keeps in proportion with whatever you're showing.

Thanks Daedalus for your reply and I'll move any more BB2 queries into the correct thread working forwards.

Seems a real shame they couldn't make creating a scrollbar easier when there are so many other easy options for modifying a new Window, but there you have it!

Daedalus 18 February 2021 13:03

Yeah, a higher level library that contains an additional layer for dealing with things like this might be a good thing to have alright. I guess they just stuck relatively closely to the actual OS calls and procedures for the most straightforward implementation (from the library's side).
As an alternative, I wonder if using MUI would be helpful? That handles things like window size, and while I'm not sure if it supports actual window scrollbars, it does support group scrollbars for gadget groups larger than the visible area.


All times are GMT +2. The time now is 06:05.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.

Page generated in 0.04486 seconds with 11 queries