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.

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.