hi...
If someone can help me with one example.
How can i get text of statusbar?
sorry for my english
Get statusbar text
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Get statusbar text
Well, if you mean the status bar text from the window of your own program, you should not need to collect it, since your app should already have the value held in a variable.......
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Get statusbar text
Had to delete all the other posts, my very crappy coding. The below is a lot nicer to readmx101 wrote:hi...
If someone can help me with one example.
How can i get text of statusbar?
sorry for my english
Code: Select all
;==========================================================================================================================
; Get the text from a specified statusbar and field in that statusbar
;==========================================================================================================================
Procedure.s GetStatusBarText(StatusbarNumber, FieldNumber)
; Find the length of the text to get from the specified statusbar (last parameter has to be 0)
StringBufferLength = SendMessage_(StatusBarID(StatusbarNumber), #SB_GETTEXTLENGTH, FieldNumber, 0)
; Proceed only if we managed to get the length of the characters to retrieve
If StringBufferLength
; Just tell the user how many characters we are going to try to get back
Debug "String length to get is: " + Str(StringBufferLength)
; Create an empty string that is the length of the characters we are going to try to get back
StringBuffer.s = Space(Length)
; Now try to get the characters back from the statusbar in the specified field into the string buffer
SendMessage_(StatusBarID(StatusbarNumber), #SB_GETTEXT, FieldNumber, @BufferString)
; Only proceed if we got any characters back
If StringBuffer.s
ProcedureReturn PeekS(@BufferString)
Else ; Return an empty string as nothing was retrieved despite the buffer length being initialised
ProcedureReturn ""
EndIf
;
Else
ProcedureReturn "There are no characters to be retrieved"
EndIf
;
EndProcedure
; Test this procedure with any program
Debug GetStatusBarText(1, 2) ; Get the text from field 2 in statusbar 1 (use constants, much better)
Last edited by Fangbeast on Mon Mar 28, 2011 9:01 pm, edited 1 time in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Re: Get statusbar text
hi...Fangbeast wrote:Had to delete all the other posts, my very crappy coding. The below is a lot nicer to readmx101 wrote:hi...
If someone can help me with one example.
How can i get text of statusbar?
sorry for my english
Code: Select all
;========================================================================================================================== ; Get the text from a specified statusbar and field in that statusbar ;========================================================================================================================== Procedure.s GetStatusBarText(StatusbarNumber, FieldNumber) ; Find the length of the text to get from the specified statusbar (last parameter has to be 0) StringBufferLength = SendMessage_(StatusBarID(StatusbarNumber), #SB_GETTEXTLENGTH, FieldNumber, 0) ; Proceed only if we managed to get the length of the characters to retrieve If StringBufferLength ; Just tell the user how many characters we are going to try to get back Debug "String length to get is: " + Str(StringBufferLength) ; Create an empty string that is the length of the characters we are going to try to get back StringBuffer.s = Space(Length) ; Now try to get the characters back from the statusbar int he specified field into the string buffer SendMessage_(StatusBarID(StatusbarNumber), #SB_GETTEXT, FieldNumber, @BufferString) ; Only proceed if we got any characters back If StringBuffer.s ProcedureReturn PeekS(@BufferString) Else ; Return an empty string as nothing was retrieved despite the buffer length being initialised ProcedureReturn "" EndIf ; Else ProcedureReturn "There are no characters to be retrieved" EndIf ; EndProcedure ; Test this procedure with any program Debug GetStatusBarText(1, 2) ; Get the text from field 2 in statusbar 1 (use constants, much better)
thank you work great.

- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Get statusbar text
My pleasure. I got something right in 9 yearshi...
thank you work great.![]()




Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet