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

Re: How to insert a statusbar?

Post by PBExplorer12 »

TI-994A wrote:
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.
Yes, the #PB_Ignore looks like it just distributes all the status bar fields, to an equal length. That's actually not a bad thing temporarily. But I'll follow along with your code, by creating an alternate StatusBarText procedure, which does the length-adjusting that you're describing above. StatusBarText() is used several times in the app, depending on any changing directories or sqlite database names, so this needs to be done outside of the OpenWindow vicinity, as well.
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: How to insert a statusbar?

Post by TI-994A »

PBExplorer12 wrote:...#PB_Ignore looks like it just distributes all the status bar fields, to an equal length.
Hi PBExplorer12. That's not quite accurate. AddStatusBarField() would only auto-size the fields initialised with #PB_Ignore. Fields initialised with specific widths would not be proportioned.
PBExplorer12 wrote:...alternate StatusBarText procedure, which does the length-adjusting that you're describing above.
That example is not a length-adjusting routine, but rather one to scroll lengthy texts in a narrow status bar field, as you requested.
PBExplorer12 wrote:StatusBarText() is used several times in the app, depending on any changing directories or sqlite database names, so this needs to be done outside of the OpenWindow vicinity...
You're right, and if you look carefully, the status bar text was not assigned in the OpenWindow procedure.

This is a fully standalone and ready-to-run example that does not utilise any external forms, which might illustrate these concepts a little better:

Code: Select all

;create a normal window
wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered 
OpenWindow(0, #PB_Ignore, #PB_Ignore, 400, 100, "StatusBar Example", wFlags)

;add a button to initiate changes in the status bar captions
ButtonGadget(1, 100, 15, 200, 50, "Click to change the caption in the " +
             "first field of the status bar...", #PB_Button_MultiLine)

;add a status bar to that window
CreateStatusBar(0, WindowID(0))

;add the first field to that status bar, 200 pixels wide
AddStatusBarField(200)

;add a caption to that field
StatusBarText(0, 0, "First Field")

;add the second field to the status bar, to be auto-sized
AddStatusBarField(#PB_Ignore)

;add a caption to the second field
StatusBarText(0, 1, "2nd field")

;add the third field to the status bar, also to be auto-sized
AddStatusBarField(#PB_Ignore)

;add a caption to the second field
StatusBarText(0, 2, "3rd field")

Repeat
  
  Select WaitWindowEvent()
      
    Case #PB_Event_CloseWindow
      appQuit = 1
      
    Case #PB_Event_Gadget
      Select EventGadget()
        
        ;button clicked
        Case 1

          ;if button clicked the second time
          If toggle 
            
            ;start a timer to scroll the first caption in the status bar
            AddWindowTimer(0, 0, 200)
            
            ;hide the button as no longer required
            HideGadget(1, 1)
            
          ;if button clicked the first time
          Else
            
            ;change the caption of the first field of the status bar
            ;to display the system's temporary directory
            StatusBarText(0, 0, GetTemporaryDirectory())
            
            ;change the caption of the button for secondary function
            SetGadgetText(1, "Click to start scrolling the caption in " +
                             "the first field of the status bar...")
            
            ;set a variable flag to activate button's secondary function
            toggle = 1
            
          EndIf
          
      EndSelect    
      
    Case #PB_Event_Timer
      
      ;caption scrolling routine
      textStartPos + 1
      StatusBarText(0, 0, Mid(GetTemporaryDirectory(), textStartPos))
      If textStartPos = 1
        Delay(1000)
      EndIf
      If textStartPos = Len(GetTemporaryDirectory())
        textStartPos = 0
      EndIf          
      
  EndSelect
  
Until appQuit = 1
Hope it helps to clarify things. :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:...#PB_Ignore looks like it just distributes all the status bar fields, to an equal length.
Hi PBExplorer12. That's not quite accurate. AddStatusBarField() would only auto-size the fields initialised with #PB_Ignore. Fields initialised with specific widths would not be proportioned.
PBExplorer12 wrote:...alternate StatusBarText procedure, which does the length-adjusting that you're describing above.
That example is not a length-adjusting routine, but rather one to scroll lengthy texts in a narrow status bar field, as you requested.
PBExplorer12 wrote:StatusBarText() is used several times in the app, depending on any changing directories or sqlite database names, so this needs to be done outside of the OpenWindow vicinity...
You're right, and if you look carefully, the status bar text was not assigned in the OpenWindow procedure.

This is a fully standalone and ready-to-run example that does not utilise any external forms, which might illustrate these concepts a little better:

Code: Select all

;create a normal window
wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered 
OpenWindow(0, #PB_Ignore, #PB_Ignore, 400, 100, "StatusBar Example", wFlags)

;add a button to initiate changes in the status bar captions
ButtonGadget(1, 100, 15, 200, 50, "Click to change the caption in the " +
             "first field of the status bar...", #PB_Button_MultiLine)

;add a status bar to that window
CreateStatusBar(0, WindowID(0))

;add the first field to that status bar, 200 pixels wide
AddStatusBarField(200)

;add a caption to that field
StatusBarText(0, 0, "First Field")

;add the second field to the status bar, to be auto-sized
AddStatusBarField(#PB_Ignore)

;add a caption to the second field
StatusBarText(0, 1, "2nd field")

;add the third field to the status bar, also to be auto-sized
AddStatusBarField(#PB_Ignore)

;add a caption to the second field
StatusBarText(0, 2, "3rd field")

Repeat
  
  Select WaitWindowEvent()
      
    Case #PB_Event_CloseWindow
      appQuit = 1
      
    Case #PB_Event_Gadget
      Select EventGadget()
        
        ;button clicked
        Case 1

          ;if button clicked the second time
          If toggle 
            
            ;start a timer to scroll the first caption in the status bar
            AddWindowTimer(0, 0, 200)
            
            ;hide the button as no longer required
            HideGadget(1, 1)
            
          ;if button clicked the first time
          Else
            
            ;change the caption of the first field of the status bar
            ;to display the system's temporary directory
            StatusBarText(0, 0, GetTemporaryDirectory())
            
            ;change the caption of the button for secondary function
            SetGadgetText(1, "Click to start scrolling the caption in " +
                             "the first field of the status bar...")
            
            ;set a variable flag to activate button's secondary function
            toggle = 1
            
          EndIf
          
      EndSelect    
      
    Case #PB_Event_Timer
      
      ;caption scrolling routine
      textStartPos + 1
      StatusBarText(0, 0, Mid(GetTemporaryDirectory(), textStartPos))
      If textStartPos = 1
        Delay(1000)
      EndIf
      If textStartPos = Len(GetTemporaryDirectory())
        textStartPos = 0
      EndIf          
      
  EndSelect
  
Until appQuit = 1
Hope it helps to clarify things. :wink:


Hi Ti,

I'm already set on this. Everything's working fine, but I'll take a look at your examples, see if the code can be improved upon.

>>Hi PBExplorer12. That's not quite accurate. AddStatusBarField() would only auto-size the fields initialised with #PB_Ignore. Fields initialised with specific widths would not be proportioned.<<

Yes, but for my purposes it does an equal distribution. In the Init() method, one of the early calls are
AddStatusBarField(#PB_Ignore)
AddStatusBarField(#PB_Ignore)
AddStatusBarField(#PB_Ignore)
AddStatusBarField(#PB_Ignore)
AddStatusBarField(#PB_Ignore)
StatusBarText( 0, #STATUSBARFIELD_CURRENTDIRECTORY, sCurrentDirectory )
StatusBarText( 0, #STATUSBARFIELD_DATABASE, "Db" )
StatusBarText( 0, #STATUSBARFIELD_TABLE, "Tbl" )
StatusBarText( 0, #STATUSBARFIELD_FILTER, "" )
StatusBarText( 0, #STATUSBARFIELD_LANGUAGE, "Language" )

, and those are the only status bar fields that are created. Any others, will be added to this section, as the app develops.

>>That example is not a length-adjusting routine, but rather one to scroll lengthy texts in a narrow status bar field, as you requested.<<

Ok, thanks TI.


Are there ways to do screen attachments, on a forum post? I can't seem to locate any Attach button.
User avatar
Demivec
Addict
Addict
Posts: 4091
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: How to insert a statusbar?

Post by Demivec »

PBExplorer12 wrote:Are there ways to do screen attachments, on a forum post? I can't seem to locate any Attach button.
You can include an image with by using:

Image

which means you will have to store it somewhere else and simply reference it in your message.
User avatar
USCode
Addict
Addict
Posts: 912
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle, USA

Re: How to insert a statusbar?

Post by USCode »

PBExplorer12 wrote:I'll contact Support, find out what's happening, thanks.
This forum IS Support ... :wink:
PBExplorer12
User
User
Posts: 59
Joined: Sun Jul 21, 2013 8:30 am

Re: How to insert a statusbar?

Post by PBExplorer12 »

Demivec wrote:
PBExplorer12 wrote:Are there ways to do screen attachments, on a forum post? I can't seem to locate any Attach button.
You can include an image with by using:

Image

which means you will have to store it somewhere else and simply reference it in your message.
Ah, ok, I see it, thanks.
PBExplorer12
User
User
Posts: 59
Joined: Sun Jul 21, 2013 8:30 am

Re: How to insert a statusbar?

Post by PBExplorer12 »

USCode wrote:
PBExplorer12 wrote:I'll contact Support, find out what's happening, thanks.
This forum IS Support ... :wink:

Yes, it is. Prompt and generous support, at that.
Post Reply