Page 1 of 2
[Given up to peer pressure] String Gadget ReadOnly
Posted: Mon Sep 11, 2017 8:53 pm
by IdeasVacuum
In Read Only mode, the User cannot edit the text in the Gadget.
I think that mode should also:
1) Not switch the mouse cursor to the text cursor;
2) Not allow text selection (for copy to the clipboard)
Re: String Gadget ReadOnly
Posted: Mon Sep 11, 2017 8:59 pm
by ts-soft
IdeasVacuum wrote:1) Not switch the mouse cursor to the text cursor;
2) Not allow text selection (for copy to the clipboard)
Why? It is important to me, to select the text.
-1
Re: String Gadget ReadOnly
Posted: Mon Sep 11, 2017 9:20 pm
by mk-soft
Code: Select all
If OpenWindow(0, #PB_Ignore, #PB_Ignore, 300, 200 ,"Read only", #PB_Window_SystemMenu)
TextGadget(0, 5, 5, 290, 190, "Total Read Only From Human Eyes", #PB_Text_Border)
SetGadgetColor(0, #PB_Gadget_BackColor, $FFFFFF)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
EndIf

Re: String Gadget ReadOnly
Posted: Mon Sep 11, 2017 11:01 pm
by IdeasVacuum
Hi mk-soft
Nice try, but TextGadget() does not trigger events.
Hi ts-soft (are you guys related?

)
What you describe could be implemented as #PB_String_NoEdit. That would mean the text can be selected and copied.
#PB_String_ReadOnly should mean exactly that - you can only read it.
Re: String Gadget ReadOnly
Posted: Tue Sep 12, 2017 8:53 am
by Kukulkan
the User cannot edit the text in the Gadget.
1) Not switch the mouse cursor to the text cursor;
2) Not allow text selection (for copy to the clipboard)
Use a TextGadget instead of a StringGadget. It fulfills all your needs

Re: String Gadget ReadOnly
Posted: Tue Sep 12, 2017 10:03 am
by said
-1
Re: String Gadget ReadOnly
Posted: Tue Sep 12, 2017 12:20 pm
by Dude
IdeasVacuum wrote:I think that mode should also:
1) Not switch the mouse cursor to the text cursor;
2) Not allow text selection (for copy to the clipboard)
DisableGadget(#StringGadget, #True) ?
IdeasVacuum wrote:#PB_String_ReadOnly should mean exactly that - you can only read it.
No, read-only means you can't write to or edit it. It doesn't mean you should only be able to literally read it with your eyes.
Kukulkan wrote:Use a TextGadget instead of a StringGadget.
This is the correct answer. A StringGadget can be switched from read-only to write-capable at any time, if the developer wishes. Disabling that capability is pointless when a TextGadget does what you want.
Also, the user may actually want to select and copy the text in a StringGadget, without editing it.
Lastly, don't forget also that PureBasic's gadgets are actually just the OS's built-in controls, so to disable it would mean PureBasic would have to add extra code to purposely do that, which in turn removes the option for the developer to further enhance that gadget with specific OS API calls.
So... I give a big
-1 for this request.

Re: String Gadget ReadOnly
Posted: Tue Sep 12, 2017 3:25 pm
by IdeasVacuum
Hi Guys
Please read my remark about the TextGadget not being a suitable replacement (applies to disable gadget too), and also consider my suggestion that a new flag, #PB_String_NoEdit, could be introduced to deliver the current restriction.
As it Stands, #PB_String_ReadOnly does not have appropriate restrictions to be
truly read only. If it was a traffic light, it would be amber when it should be red

Re: String Gadget ReadOnly
Posted: Tue Sep 12, 2017 3:46 pm
by Kukulkan
Nice try, but TextGadget() does not trigger events.
But what useful events are left, if you can't select and edit?
I believe the problem is that PB uses standard OS gadgets. And your wish seems not possible with the standard OS gadgets on all three OS. Thus, Fred would need to do his own string gadget. And, as Dude already mentioned, this would disable any other standard OS API calls.
Maybe you can do your own Gadget by wrapping a standard StringGadget to a container (eg ContainerGadget, FrameGadget or ScrollAreaGadget)? By this, you possibly can modify the container in a way the behavior of the gadget inside is like you want it to be? Just an untested idea...
Re: String Gadget ReadOnly
Posted: Tue Sep 12, 2017 6:49 pm
by mk-soft
Event for TextGadget use flag '#SS_Notify'
Code: Select all
TextGadget(0, 5, 5, 290, 190, "Total Read Only From Human Eyes", #SS_NOTIFY | #PB_Text_Border)
I don“t know this for mac or Linux
Re: String Gadget ReadOnly
Posted: Tue Sep 12, 2017 10:37 pm
by Dude
IdeasVacuum wrote:#PB_String_ReadOnly does not have appropriate restrictions to be truly read only
Yes it does. It's 100% read-only. You're simply re-defining "read only" to be what
you think it should be.
Read-only has nothing to do with
displaying text; it's all about preventing the
changing of that text.
Re: String Gadget ReadOnly
Posted: Fri Sep 15, 2017 10:58 pm
by Opcode
-1
You can accomplish what you're looking for with a canvas and drawtext. I prefer being able to copy text in a string gadget in read-only mode, just not have it editable (which is the purpose).
Re: [Given up to peer pressure] String Gadget ReadOnly
Posted: Sat Sep 16, 2017 12:19 am
by IdeasVacuum
Well, I have given up on this one, bigger fish to fry.
I was not asking to remove
any of the functionality that is already delivered (and clearly loved by the protesters on this post), but to enhance it (re flags suggestion) for more flexibility.

Re: [Given up to peer pressure] String Gadget ReadOnly
Posted: Sat Sep 16, 2017 3:04 am
by Dude
IdeasVacuum wrote:enhance it (re flags suggestion) for more flexibility
The StringGadget is a standard Windows control, so Fred
can't enhance it.
IdeasVacuum wrote:1) Not switch the mouse cursor to the text cursor;
2) Not allow text selection (for copy to the clipboard)
What's wrong with disabling the StringGadget to achieve both of these?
Code: Select all
OpenWindow(0,200,200,400,70,"test",#PB_Window_SystemMenu)
ButtonGadget(1,10,20,60,25,"Allow tab")
ButtonGadget(2,80,20,60,25,"Allow tab")
StringGadget(3,150,20,230,25,"Can't tab here or select this text")
DisableGadget(3,#True)
SetActiveGadget(1)
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
Re: [Given up to peer pressure] String Gadget ReadOnly
Posted: Sat Sep 16, 2017 4:53 am
by Thunder93
While DisableGadget() seems to be the proper fit, conveniently disabling user inputs that includes selection and copying abilities. I don't like the fact it greys out the text colour and making it very difficult to see.
It wouldn't be difficult for Fred to have support for the purposed feature. Therefore
+1 for me.
