Code: Select all
Structure CueData ;
SearchCueFont.i ; Searchbox cue font
SearchNormalFont.i ; Searchbox normal font
SearchCueText.s ; Search box prompt text
EndStructure ;
Global Cue.CueData ;
Cue\SearchCueFont = LoadFont(#PB_Any, "Georgia", 12, #PB_Font_Italic) ; Empty search cue font
Cue\SearchNormalFont = LoadFont(#PB_Any, "Comic Sans MS", 12, 0) ; Filled cue box font
Cue\SearchCueText = Space(256) ; Set the cue text buffer
PokeS(@Cue\SearchCueText, "Search for what?..", -1, #PB_Unicode) ; Fill the buffer with the cue text
; Set initial search cue font
SetGadgetFont(#Gadget_MyAddressbook_Searchstring, FontID(Cue\SearchCueFont))
SendMessage_(GadgetID(#Gadget_MyAddressbook_Searchstring), #EM_SETLIMITTEXT, 67, 0)
SendMessage_(GadgetID(#Gadget_MyAddressbook_Searchstring), #EM_SETCUEBANNER, 1, Cue\SearchCueText)
Have run into a problem with poking a string into a map element and wondering if there was another way of doing this as I gather that setting a cue requires a string to be poked into a buffer and the map element does not behave like this (Like a string memory buffer?
This is how I am doing it now and get an error on the line with a poke. ANy way to fix this or is there a way around it?
Code: Select all
Structure ProgramData ;
Map String.s() ; For all string variabls
Map Number.i() ; For all integer variables
EndStructure ;
Global Program.ProgramData ; Declare a global map
; Search cue prompt in text boxes
Program\Number("Search cue font") = LoadFont(#PB_Any, "Georgia", 12, #PB_Font_Italic) ; Empty search cue font
Program\Number("Search normal font") = LoadFont(#PB_Any, "Comic Sans MS", 12, 0) ; Filled cue box font
Program\String("Search cue text") = Space(256) ; Set the cue text buffer
PokeS(@Program\String("Search cue text"), "Search for what?..", -1, #PB_Unicode) ; Fill the buffer with the cue text
Debug Program\String("Search cue text") ; [ERROR} Invalid memory access. (read error at address 6619219)
; SetGadgetFont(#Gadget_MyAddressbook_Searchstring, FontID(Cue\SearchCueFont)) ; Apply the loaded font tot he banner text
; SendMessage_(GadgetID(#Gadget_MyAddressbook_Searchstring), #EM_SETLIMITTEXT, 67, 0) ; Limit the text display length of the gadget
; SendMessage_(GadgetID(#Gadget_MyAddressbook_Searchstring), #EM_SETCUEBANNER, 1, Program\String("Search cue text")) ; Set the cue banner text to the gadget