How to insert a statusbar?

You need some new stunning features ? Tell us here.
PBExplorer12
User
User
Posts: 59
Joined: Sun Jul 21, 2013 8:30 am

How to insert a statusbar?

Post by PBExplorer12 »

Hi,

I'm confused about how to insert a Status Bar, into an existing form.

If you open up your main form, then double-click on the StatusBar object, under Menus & Toolbars, nothing happens.

If, after double-clicking on the statusbar object, you switch the Form to Code View, there's no change.

If you directly insert some of the Help file sample StatusBar code, into the Form Code, right after Open Window, it eventually disappears. For a short time, I saw the Status Bar, in the Design View, but when I compiled and ran the app, there was no StatusBar, real-time.

So, how do we insert a Status Bar, into our application? Is there a way to insert one, while in the Designer? If not, where do we place the CreateStatusBar and StatusBarText code?
PBExplorer12
User
User
Posts: 59
Joined: Sun Jul 21, 2013 8:30 am

Re: How to insert a statusbar?

Post by PBExplorer12 »

PBExplorer12 wrote:Hi,

I'm confused about how to insert a Status Bar, into an existing form.

If you open up your main form, then double-click on the StatusBar object, under Menus & Toolbars, nothing happens.

If, after double-clicking on the statusbar object, you switch the Form to Code View, there's no change.

If you directly insert some of the Help file sample StatusBar code, into the Form Code, right after Open Window, it eventually disappears. For a short time, I saw the Status Bar, in the Design View, but when I compiled and ran the app, there was no StatusBar, real-time.

So, how do we insert a Status Bar, into our application? Is there a way to insert one, while in the Designer? If not, where do we place the CreateStatusBar and StatusBarText code?
Btw, dragging and dropping doesn't work, either.
User avatar
TI-994A
Addict
Addict
Posts: 2740
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: How to insert a statusbar?

Post by TI-994A »

PBExplorer12 wrote:...how do we insert a Status Bar, into our application? Is there a way to insert one, while in the Designer?
Hello PBExplorer12. For some reason, menus and toolbars cannot be dragged & dropped onto the form. To instantiate them, they'd have to be double-clicked, or clicked once then dragged & drawn on the form. To repeat, this only instantiates the gadget, but does not create them yet. Items and objects must be added to them by clicking on the icon that appears on them (a small document icon with a green plus sign). Once added, the relevant code for these gadgets will be generated, and they will appear at runtime.

Further to this, besides the layout code that appears in the OpenWIndow_X procedure, Form Designer does not allow any other code to be added manually. Such additions will be wiped out, as you have seen. Add these three status bar commands to the OpenWIndow_X procedure, and it will also be created accordingly:

Code: Select all

Procedure OpenWindow_0...
  Window_0 = OpenWindow...
  CreateStatusBar(0, WindowID(Window_0))
  AddStatusBarField(100)
  StatusBarText(0, 0, "MyStatusBar")
Hope it works out. :wink:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
PBExplorer12
User
User
Posts: 59
Joined: Sun Jul 21, 2013 8:30 am

Re: How to insert a statusbar?

Post by PBExplorer12 »

TI-994A wrote:
PBExplorer12 wrote:...how do we insert a Status Bar, into our application? Is there a way to insert one, while in the Designer?
Hello PBExplorer12. For some reason, menus and toolbars cannot be dragged & dropped onto the form. To instantiate them, they'd have to be double-clicked, or clicked once then dragged & drawn on the form. To repeat, this only instantiates the gadget, but does not create them yet. Items and objects must be added to them by clicking on the icon that appears on them (a small document icon with a green plus sign). Once added, the relevant code for these gadgets will be generated, and they will appear at runtime.

Further to this, besides the layout code that appears in the OpenWIndow_X procedure, Form Designer does not allow any other code to be added manually. Such additions will be wiped out, as you have seen. Add these three status bar commands to the OpenWIndow_X procedure, and it will also be created accordingly:

Code: Select all

Procedure OpenWindow_0...
  Window_0 = OpenWindow...
  CreateStatusBar(0, WindowID(Window_0))
  AddStatusBarField(100)
  StatusBarText(0, 0, "MyStatusBar")
Hope it works out. :wink:
Doesn't work at all. Whether I double-click or single-click and drag, the status bar doesn't show up anywhere on the forum. So I can't add items visually.

I just tried inserting your CreateStatusBar code, into the OpenWindow proc (called OpenfrmFirstForm, in my code). I had done this previously, and it displayed in the Designer, but eventually disappeared.

However, the status bar seems to be persistent now, the Creation code seems to be remaining in the OpenfrmFirstForm proc. So, we'll see what happens, thanks.
PBExplorer12
User
User
Posts: 59
Joined: Sun Jul 21, 2013 8:30 am

Re: How to insert a statusbar?

Post by PBExplorer12 »

PBExplorer12 wrote:
TI-994A wrote:
PBExplorer12 wrote:...how do we insert a Status Bar, into our application? Is there a way to insert one, while in the Designer?
Hello PBExplorer12. For some reason, menus and toolbars cannot be dragged & dropped onto the form. To instantiate them, they'd have to be double-clicked, or clicked once then dragged & drawn on the form. To repeat, this only instantiates the gadget, but does not create them yet. Items and objects must be added to them by clicking on the icon that appears on them (a small document icon with a green plus sign). Once added, the relevant code for these gadgets will be generated, and they will appear at runtime.

Further to this, besides the layout code that appears in the OpenWIndow_X procedure, Form Designer does not allow any other code to be added manually. Such additions will be wiped out, as you have seen. Add these three status bar commands to the OpenWIndow_X procedure, and it will also be created accordingly:

Code: Select all

Procedure OpenWindow_0...
  Window_0 = OpenWindow...
  CreateStatusBar(0, WindowID(Window_0))
  AddStatusBarField(100)
  StatusBarText(0, 0, "MyStatusBar")
Hope it works out. :wink:
Doesn't work at all. Whether I double-click or single-click and drag, the status bar doesn't show up anywhere on the forum. So I can't add items visually.

I just tried inserting your CreateStatusBar code, into the OpenWindow proc (called OpenfrmFirstForm, in my code). I had done this previously, and it displayed in the Designer, but eventually disappeared.

However, the status bar seems to be persistent now, the Creation code seems to be remaining in the OpenfrmFirstForm proc. So, we'll see what happens, thanks.

Looks good, working as expected.
User avatar
TI-994A
Addict
Addict
Posts: 2740
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: How to insert a statusbar?

Post by TI-994A »

PBExplorer12 wrote:Doesn't work at all. Whether I double-click or single-click and drag, the status bar doesn't show up anywhere on the forum. So I can't add items visually.
Hi PBExplorer12. What version of PureBasic are you using? Adding menus and toolbars by double-clicking is only possible in PureBasic 5.20.

If you are using an earlier version, you can still draw (not drag & drop) them onto the form:
1. Click once on the Menu, ToolBar, or StatusBar object in the toolbox (click and let go).
2. Move the mouse cursor over to the form (don't press any mouse button, just move).
3. Now, anywhere on the form, press and hold the left mouse button, move the mouse a little, then release the button.
4. The Menu, ToolBar, or StatusBar should now be drawn onto the form.
5. Click on the small document icon with the green plus sign and add the required items.

That's all. :wink:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
PBExplorer12
User
User
Posts: 59
Joined: Sun Jul 21, 2013 8:30 am

Re: How to insert a statusbar?

Post by PBExplorer12 »

TI-994A wrote:
PBExplorer12 wrote:Doesn't work at all. Whether I double-click or single-click and drag, the status bar doesn't show up anywhere on the forum. So I can't add items visually.
Hi PBExplorer12. What version of PureBasic are you using? Adding menus and toolbars by double-clicking is only possible in PureBasic 5.20.

If you are using an earlier version, you can still draw (not drag & drop) them onto the form:
1. Click once on the Menu, ToolBar, or StatusBar object in the toolbox (click and let go).
2. Move the mouse cursor over to the form (don't press any mouse button, just move).
3. Now, anywhere on the form, press and hold the left mouse button, move the mouse a little, then release the button.
4. The Menu, ToolBar, or StatusBar should now be drawn onto the form.
5. Click on the small document icon with the green plus sign and add the required items.

That's all. :wink:

You're right. I have 5.11. I purchased it fairly recently, and didn't realize there was an upgrade.

Ok, thanks.
PBExplorer12
User
User
Posts: 59
Joined: Sun Jul 21, 2013 8:30 am

Re: How to insert a statusbar?

Post by PBExplorer12 »

PBExplorer12 wrote:
TI-994A wrote:
PBExplorer12 wrote:Doesn't work at all. Whether I double-click or single-click and drag, the status bar doesn't show up anywhere on the forum. So I can't add items visually.
Hi PBExplorer12. What version of PureBasic are you using? Adding menus and toolbars by double-clicking is only possible in PureBasic 5.20.

If you are using an earlier version, you can still draw (not drag & drop) them onto the form:
1. Click once on the Menu, ToolBar, or StatusBar object in the toolbox (click and let go).
2. Move the mouse cursor over to the form (don't press any mouse button, just move).
3. Now, anywhere on the form, press and hold the left mouse button, move the mouse a little, then release the button.
4. The Menu, ToolBar, or StatusBar should now be drawn onto the form.
5. Click on the small document icon with the green plus sign and add the required items.

That's all. :wink:

You're right. I have 5.11. I purchased it fairly recently, and didn't realize there was an upgrade.

Ok, thanks.

Confused. When I go to the download area, the most recent version that's being offered is 5.11.

I'll contact Support, find out what's happening, thanks.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: How to insert a statusbar?

Post by Polo »

This feature will be available in 5.20 (or you can download the beta version of 5.20)
PBExplorer12
User
User
Posts: 59
Joined: Sun Jul 21, 2013 8:30 am

Re: How to insert a statusbar?

Post by PBExplorer12 »

Polo wrote:This feature will be available in 5.20 (or you can download the beta version of 5.20)

Ah, ok. Understood. I'll hold off, for now, everything's working fine.


I have to try to resolve the problem of static fields on the Status bar, to programmatically make them 'stretch' in some way, when needed.

For example, if the current directory is just 'c:\Projects', then a small number of characters are fine. But if it's something like 'c:\program Files (x86)\AnvSoft\Any DVD Converter Professional\data\Sample', it would be cool to have it automatically stretch. (up to a maximum number of characters; longer than that, and scrolling is enabled).

If you have any suggestions, please let me know. Planning to just write some code to perform this.
User avatar
TI-994A
Addict
Addict
Posts: 2740
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: How to insert a statusbar?

Post by TI-994A »

PBExplorer12 wrote:
TI-994A wrote:
PBExplorer12 wrote:Doesn't work at all. Whether I double-click or single-click and drag, the status bar doesn't show up anywhere on the forum. So I can't add items visually.
Hi PBExplorer12. What version of PureBasic are you using? Adding menus and toolbars by double-clicking is only possible in PureBasic 5.20.

If you are using an earlier version, you can still draw (not drag & drop) them onto the form:
1. Click once on the Menu, ToolBar, or StatusBar object in the toolbox (click and let go).
2. Move the mouse cursor over to the form (don't press any mouse button, just move).
3. Now, anywhere on the form, press and hold the left mouse button, move the mouse a little, then release the button.
4. The Menu, ToolBar, or StatusBar should now be drawn onto the form.
5. Click on the small document icon with the green plus sign and add the required items.

That's all. :wink:
You're right. I have 5.11. I purchased it fairly recently, and didn't realize there was an upgrade.
Hello PBExplorer12. The steps outlined above work on the Form Designer in PureBasic 5.11 as well.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
PBExplorer12
User
User
Posts: 59
Joined: Sun Jul 21, 2013 8:30 am

Re: How to insert a statusbar?

Post by PBExplorer12 »

TI-994A wrote:
PBExplorer12 wrote:
TI-994A wrote:
PBExplorer12 wrote:Doesn't work at all. Whether I double-click or single-click and drag, the status bar doesn't show up anywhere on the forum. So I can't add items visually.
Hi PBExplorer12. What version of PureBasic are you using? Adding menus and toolbars by double-clicking is only possible in PureBasic 5.20.

If you are using an earlier version, you can still draw (not drag & drop) them onto the form:
1. Click once on the Menu, ToolBar, or StatusBar object in the toolbox (click and let go).
2. Move the mouse cursor over to the form (don't press any mouse button, just move).
3. Now, anywhere on the form, press and hold the left mouse button, move the mouse a little, then release the button.
4. The Menu, ToolBar, or StatusBar should now be drawn onto the form.
5. Click on the small document icon with the green plus sign and add the required items.

That's all. :wink:
You're right. I have 5.11. I purchased it fairly recently, and didn't realize there was an upgrade.
Hello PBExplorer12. The steps outlined above work on the Form Designer in PureBasic 5.11 as well.
Ok. I don't know what I did wrong previously, but the statusbar is on the form now, and has been there all day. All set, problelm solved, thanks TI.
User avatar
TI-994A
Addict
Addict
Posts: 2740
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: How to insert a statusbar?

Post by TI-994A »

PBExplorer12 wrote:I have to try to resolve the problem of static fields on the Status bar, to programmatically make them 'stretch' in some way, when needed.

For example, if the current directory is just 'c:\Projects', then a small number of characters are fine. But if it's something like 'c:\program Files (x86)\AnvSoft\Any DVD Converter Professional\data\Sample', it would be cool to have it automatically stretch. (up to a maximum number of characters; longer than that, and scrolling is enabled).
Great! To auto-size the status bar field, simply create it with AddStatusBarField(#PB_Ignore).

Not too sure about scrolling the text though. :wink:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
TI-994A
Addict
Addict
Posts: 2740
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: How to insert a statusbar?

Post by TI-994A »

PBExplorer12 wrote:...it would be cool to have it automatically stretch. (up to a maximum number of characters; longer than that, and scrolling is enabled).
Hello again. Probably not the type of scrolling you're looking for, but it's a start:

Code: Select all

IncludeFile "MyForm.pbf"
Global statText.s = GetTemporaryDirectory()

OpenWindow_0()
AddWindowTimer(Window_0, 0, 200)

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      appQuit = 1
    Case #PB_Event_Timer
      t + 1
      StatusBarText(0, 0, Mid(statText, t))
      If t = Len(statText)
        t = 0
      EndIf
  EndSelect
Until appQuit = 1
In the form code, set the AddStatusBarField() to a small value, around 200; don't use #PB_Ignore.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
PBExplorer12
User
User
Posts: 59
Joined: Sun Jul 21, 2013 8:30 am

Re: How to insert a statusbar?

Post by PBExplorer12 »

TI-994A wrote:
PBExplorer12 wrote:I have to try to resolve the problem of static fields on the Status bar, to programmatically make them 'stretch' in some way, when needed.

For example, if the current directory is just 'c:\Projects', then a small number of characters are fine. But if it's something like 'c:\program Files (x86)\AnvSoft\Any DVD Converter Professional\data\Sample', it would be cool to have it automatically stretch. (up to a maximum number of characters; longer than that, and scrolling is enabled).
Great! To auto-size the status bar field, simply create it with AddStatusBarField(#PB_Ignore).

Not too sure about scrolling the text though. :wink:


Perfect, thanks.
Post Reply