It is currently Sat Nov 25, 2017 3:00 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 27 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: [Given up to peer pressure] String Gadget ReadOnly
PostPosted: Mon Sep 11, 2017 8:53 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5688
Location: Wales, UK
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)

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Last edited by IdeasVacuum on Fri Sep 15, 2017 11:18 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: String Gadget ReadOnly
PostPosted: Mon Sep 11, 2017 8:59 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5726
Location: Berlin - Germany
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

_________________
PureBasic 5.61 | SpiderBasic 2.10 | Windows 10 Pro (x64) | Linux Mint 18.2 (x64)
I would like to change the world, but God does not release the source code.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: String Gadget ReadOnly
PostPosted: Mon Sep 11, 2017 9:20 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1035
Location: Germany
Code:
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

:mrgreen:

_________________
My Projects OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer /
PB v3.30 / v5.60 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: String Gadget ReadOnly
PostPosted: Mon Sep 11, 2017 11:01 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5688
Location: Wales, UK
Hi mk-soft

Nice try, but TextGadget() does not trigger events.

Hi ts-soft (are you guys related? :D )

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.


Top
 Profile  
Reply with quote  
 Post subject: Re: String Gadget ReadOnly
PostPosted: Tue Sep 12, 2017 8:53 am 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 06, 2005 2:35 pm
Posts: 1070
Location: germany
Quote:
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 :D


Top
 Profile  
Reply with quote  
 Post subject: Re: String Gadget ReadOnly
PostPosted: Tue Sep 12, 2017 10:03 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 322
-1


Top
 Profile  
Reply with quote  
 Post subject: Re: String Gadget ReadOnly
PostPosted: Tue Sep 12, 2017 12:20 pm 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1027
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. :)


Top
 Profile  
Reply with quote  
 Post subject: Re: String Gadget ReadOnly
PostPosted: Tue Sep 12, 2017 3:25 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5688
Location: Wales, UK
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 :mrgreen:

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: String Gadget ReadOnly
PostPosted: Tue Sep 12, 2017 3:46 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 06, 2005 2:35 pm
Posts: 1070
Location: germany
Quote:
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...


Top
 Profile  
Reply with quote  
 Post subject: Re: String Gadget ReadOnly
PostPosted: Tue Sep 12, 2017 6:49 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1035
Location: Germany
Event for TextGadget use flag '#SS_Notify'
Code:
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

_________________
My Projects OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer /
PB v3.30 / v5.60 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: String Gadget ReadOnly
PostPosted: Tue Sep 12, 2017 10:37 pm 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1027
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. :wink:

Read-only has nothing to do with displaying text; it's all about preventing the changing of that text.


Top
 Profile  
Reply with quote  
 Post subject: Re: String Gadget ReadOnly
PostPosted: Fri Sep 15, 2017 10:58 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Jul 18, 2013 4:58 am
Posts: 105
-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).

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: [Given up to peer pressure] String Gadget ReadOnly
PostPosted: Sat Sep 16, 2017 12:19 am 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5688
Location: Wales, UK
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. :cry:

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Given up to peer pressure] String Gadget ReadOnly
PostPosted: Sat Sep 16, 2017 3:04 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1027
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:
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


Top
 Profile  
Reply with quote  
 Post subject: Re: [Given up to peer pressure] String Gadget ReadOnly
PostPosted: Sat Sep 16, 2017 4:53 am 
Offline
Addict
Addict
User avatar

Joined: Tue Mar 21, 2006 12:31 am
Posts: 1773
Location: Canada
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. :twisted:

_________________
ʽʽ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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 27 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye