Constants Verification
Posted: Fri Oct 04, 2024 9:01 pm
I have used the example for the file system and slightly modified it to show the actual values corresponding to the constants. However it appears that some of the documented values for the constants are the same as others. This is shown in the code example provided below. So is this an error or was this really meant to be the same values. I used pb version 6.04 x64 for this code. Thanks in advance.
Code: Select all
;10032024 - File System Example
If OpenWindow(0, 100, 200, 290, 200, "PureBasic - FileSystem Example")
; StringGadget (0, 10, 10, 202, 24, GetHomeDirectory())
StringGadget (0, 10, 10, 202, 24, "E:\TEST")
ButtonGadget (1, 220, 10, 60 , 24, "List")
ListViewGadget(2, 10, 40, 270, 150); Directory Listings
ListViewGadget(3, 10, 40, 270, 150); File System Attribute Listings
;----- FS Attrib List
ClearGadgetItems(3)
AddGadgetItem(3, -1, "PB Hide Constant Value is: " + Str(#PB_FileSystem_Hidden))
AddGadgetItem(3, -1, "PB Archive Constant Value is: " + Str(#PB_FileSystem_Archive))
AddGadgetItem(3, -1, "PB Compressed Constant Value is: " + Str(#PB_FileSystem_Compressed))
AddGadgetItem(3, -1, "PB Forced Constant Value is: " + Str(#PB_FileSystem_Force))
AddGadgetItem(3, -1, "PB NoExtension Constant Value is: " + Str(#PB_FileSystem_NoExtension))
AddGadgetItem(3, -1, "PB Normal Constant Value is: " + Str(#PB_FileSystem_Normal))
AddGadgetItem(3, -1, "PB ReadOnly Constant Value is: " + Str(#PB_FileSystem_ReadOnly))
AddGadgetItem(3, -1, "PB ReCursive Constant Value is: " + Str(#PB_FileSystem_Recursive))
AddGadgetItem(3, -1, "PB System Constant Value is: " + Str(#PB_FileSystem_System))
;----- Event Loop
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
If EventGadget() = 1 ; Read
ClearGadgetItems(2) ; Clear all the items found in the ListView
If ExamineDirectory(0, GetGadgetText(0), "*.*")
While NextDirectoryEntry(0)
FileName$ = DirectoryEntryName(0)
If DirectoryEntryType(0) = #PB_DirectoryEntry_Directory
FileName$ = "[DIR] "+FileName$
EndIf
AddGadgetItem(2, -1, FileName$)
Wend
Else
MessageRequester("Error","Can't examine this directory: "+GetGadgetText(0),0)
EndIf
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
EndIf