English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 28 January 2021, 22:04   #1
JJ__
Registered User

 
Join Date: Jan 2021
Location: UK
Posts: 28
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.
JJ__ is offline  
Old 30 January 2021, 00:28   #2
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 5,355
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.
Daedalus is offline  
Old 30 January 2021, 01:13   #3
Coagulus
Gets there in the end...

Coagulus's Avatar
 
Join Date: Sep 2005
Location: Wales
Posts: 774
I'm sure I remember one of the Blitz examples had a superbitmap window with a scroll gadget but I could be wrong.
Coagulus is offline  
Old 30 January 2021, 18:55   #4
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 5,355
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!
Daedalus is offline  
Old 18 February 2021, 11:21   #5
JJ__
Registered User

 
Join Date: Jan 2021
Location: UK
Posts: 28
Thumbs up

Quote:
Originally Posted by Daedalus View Post
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!
JJ__ is offline  
Old 18 February 2021, 13:03   #6
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 5,355
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.
Daedalus is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
[blitz basic] How much amiga-blitz friendly is this? saimon69 Coders. Blitz Basic 104 29 November 2016 20:45
Blitz Basic (1) Retro1234 Coders. Blitz Basic 9 18 February 2016 17:54
Blitz Basic CustomCop command JPQ Coders. General 1 23 November 2014 22:23
Blitz 2 command information Anakirob request.Other 4 31 May 2011 22:21
Blitz Basic 2 LaundroMat Retrogaming General Discussion 5 24 July 2001 08:10

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 23:58.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.07986 seconds with 15 queries