[Given up to peer pressure] String Gadget ReadOnly
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
[Given up to peer pressure] String Gadget ReadOnly
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)
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)
Last edited by IdeasVacuum on Fri Sep 15, 2017 11:18 pm, edited 1 time in total.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: String Gadget ReadOnly
Why? It is important to me, to select the text.IdeasVacuum wrote:1) Not switch the mouse cursor to the text cursor;
2) Not allow text selection (for copy to the clipboard)
-1
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Re: String Gadget ReadOnly
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
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: String Gadget ReadOnly
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.
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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: String Gadget ReadOnly
Use a TextGadget instead of a StringGadget. It fulfills all your needsthe 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)
Re: String Gadget ReadOnly
DisableGadget(#StringGadget, #True) ?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)
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.IdeasVacuum wrote:#PB_String_ReadOnly should mean exactly that - you can only read it.
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.Kukulkan wrote:Use a TextGadget instead of a StringGadget.
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.
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: String Gadget ReadOnly
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
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
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: String Gadget ReadOnly
But what useful events are left, if you can't select and edit?Nice try, but TextGadget() does not trigger events.
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
Event for TextGadget use flag '#SS_Notify'
I don´t know this for mac or Linux
Code: Select all
TextGadget(0, 5, 5, 290, 190, "Total Read Only From Human Eyes", #SS_NOTIFY | #PB_Text_Border)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: String Gadget ReadOnly
Yes it does. It's 100% read-only. You're simply re-defining "read only" to be what you think it should be.IdeasVacuum wrote:#PB_String_ReadOnly does not have appropriate restrictions to be truly read only
Read-only has nothing to do with displaying text; it's all about preventing the changing of that text.
Re: String Gadget ReadOnly
-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).
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).
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: [Given up to peer pressure] String Gadget ReadOnly
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.
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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: [Given up to peer pressure] String Gadget ReadOnly
The StringGadget is a standard Windows control, so Fred can't enhance it.IdeasVacuum wrote:enhance it (re flags suggestion) for more flexibility
What's wrong with disabling the StringGadget to achieve both of these?IdeasVacuum wrote:1) Not switch the mouse cursor to the text cursor;
2) Not allow text selection (for copy to the clipboard)
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
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.
It wouldn't be difficult for Fred to have support for the purposed feature. Therefore +1 for me.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley