I know you want cross-platform, but for Windows only you can do this:thinkitsimple wrote:can i change a flag (#PB_String_ReadOnly) after the StringGadget is created?
Code: Select all
SendMessage_(GadgetID(gad),#EM_SETREADONLY,state,0)
I know you want cross-platform, but for Windows only you can do this:thinkitsimple wrote:can i change a flag (#PB_String_ReadOnly) after the StringGadget is created?
Code: Select all
SendMessage_(GadgetID(gad),#EM_SETREADONLY,state,0)
Code: Select all
EnableExplicit
Define.i Event, Exit
OpenWindow(0, 0, 0, 400, 300, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ContainerGadget(9, 0, 0, 200, 160)
StringGadget(0, 10, 10, 100, 20, "")
StringGadget(1, 10, 40, 100, 20, "")
StringGadget(2, 10, 70, 100, 20, "")
StringGadget(3, 10, 100, 100, 20, "")
TextGadget(5, 10, 130, 100, 20, "DummyText")
CloseGadgetList()
DisableGadget(9, #True)
ButtonGadget(10, 200, 10, 80, 30, "Toggle", #PB_Button_Toggle)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
If EventGadget() = 10
If GetGadgetState(10)
DisableGadget(9, #False)
Else
SetActiveGadget(5)
DisableGadget(9, #True)
EndIf
EndIf
Case #PB_Event_CloseWindow
Exit = #True
EndSelect
Until Exit
Code: Select all
OpenWindow(0, 0, 0, 400, 300, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
StringGadget(0, 10, 10, 100, 20, "")
StringGadget(1, 10, 40, 100, 20, "")
StringGadget(2, 10, 70, 100, 20, "")
StringGadget(3, 10, 100, 100, 20, "")
EditorGadget(5, 10, 130, 100, 20)
SetGadgetText(5,"For test")
ButtonGadget(10, 200, 10, 80, 30, "Toggle", #PB_Button_Toggle)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Menu
Select EventMenu()
Case 10,11
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case 0 To 3
If Flag = 1
SetGadgetAttribute(EventGadget(),#PB_String_MaximumLength,0)
AddKeyboardShortcut(0,#PB_Shortcut_Delete,10)
AddKeyboardShortcut(0,#PB_Shortcut_Back,11)
;AddKeyboardShortcut(0,#PB_Shortcut_Left,12)
;AddKeyboardShortcut(0,#PB_Shortcut_Right,13)
Else
SetGadgetAttribute(EventGadget(),#PB_String_MaximumLength,256)
RemoveKeyboardShortcut(0,#PB_Shortcut_All)
EndIf
Debug GetGadgetText(EventGadget())
Case 5
RemoveKeyboardShortcut(0,#PB_Shortcut_All)
Case 10
If GetGadgetState(10)
flag = 1
Else
flag = 0
EndIf
EndSelect
Case #PB_Event_CloseWindow
Exit = #True
EndSelect
Until Exit
Nope.In other words: can i change a flag (#PB_String_ReadOnly) after the StringGadget is created?
Code: Select all
;EnableExplicit
Global Flag
Procedure _GetGadgetText(Gad)
If Flag = 1
DisableGadget(9, #False)
Debug GetGadgetText(Gad)
DisableGadget(9, #True)
Else
Debug GetGadgetText(Gad)
EndIf
EndProcedure
OpenWindow(0, 0, 0, 400, 300, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ContainerGadget(9, 0, 0, 200, 160)
StringGadget(0, 10, 10, 100, 20, "")
StringGadget(1, 10, 40, 100, 20, "")
StringGadget(2, 10, 70, 100, 20, "")
StringGadget(3, 10, 100, 100, 20, "")
TextGadget(5, 10, 130, 100, 20, "DummyText")
CloseGadgetList()
ButtonGadget(10, 200, 10, 80, 30, "Toggle", #PB_Button_Toggle)
ButtonGadget(20, 200, 50, 80, 30, "Get #0 Text")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 10
If GetGadgetState(10) = 0
DisableGadget(9, #False)
Flag = 0
Else
OldGad = GetActiveGadget()
SetActiveGadget(5)
SetGadgetColor(0,#PB_Gadget_BackColor,$ABF6FE)
DisableGadget(9, #True)
Flag = 1
EndIf
Case 20
_GetGadgetText(0)
EndSelect
Case #PB_Event_CloseWindow
Exit = #True
EndSelect
Until Exit
Not quite right! I posted already this code example which demonstrates how to toggle the read only attribute of a StringGadget cross-platform...IdeasVacuum wrote:Nope.In other words: can i change a flag (#PB_String_ReadOnly) after the StringGadget is created?