1. Control question

Hello,

If I type, ?EditText568, I get:

247

I suppose this is the handler.

Let's say all I have is 247, How do I get the EditText or control name?

Don Cole

new topic     » topic index » view message » categorize

2. Re: Control question

DonCole said...

Hello,

If I type, ?EditText568, I get:

247

I suppose this is the handler.

Let's say all I have is 247, How do I get the EditText or control name?

Don Cole

  if getControlInfo(247, CONTROLINFO_type) = EditText then ... 
new topic     » goto parent     » topic index » view message » categorize

3. Re: Control question

DerekParnell said...
DonCole said...

Hello,

If I type, ?EditText568, I get:

247

I suppose this is the handler.

Let's say all I have is 247, How do I get the EditText or control name?

Don Cole

Thank you Derek,

This tells me it's an EditText control.

What I want to know is which EditText control eg. EditText557, EditText558, EditText559 etc...

Don Cole

  if getControlInfo(247, CONTROLINFO_type) = EditText then ... 
new topic     » goto parent     » topic index » view message » categorize

4. Re: Control question

DonCole said...

What I want to know is which EditText control eg. EditText557, EditText558, EditText559 etc...

By default, each control as it is created is given a name based on the 'caption text' for it. This is 'sort of' okay but not very precise. However, you can give any control its own name and later, given a control id, get the name for it.

    EditText557 = createEx(EditText, "", win, ...) 
    setIdName(EditText557, "SurName") 
 
    ... 
 
    if equal( getNameId(someid), "SurName") then ... 

Also note that the name given to a control will be stripped of any non-alphabetic characters except the underscore. Thus setIdName(x, "My great name!") causes getNameId(x) to return "Mygreatname".

Another potential issue is that it is quite possible to have duplicate ID names. Win32lib doesn't really care if you give two different controls that same ID name. That's up to you to monitor.

If it would be useful, I could update the IDE to automatically set each control's name to the name used by the IDE, such that it would generate code like ...

constant EditText557 = createEx(EditText, "", win, ...) 
    setIdName(EditText557, "EditText557") 
new topic     » goto parent     » topic index » view message » categorize

5. Re: Control question

I made a mistake in my earlier post. The correct function is getNameId() and not getIdName().

There is also another useful function that returns a control's ID given it's name and parent ID. This can be used when controls have the same ID name but different parents.

   id = getNameIdInContext("SurName", win) 
 
-- or even ... 
 
   id = getNameIdInContext("SurName", "CustomerMaintenance") 
 
new topic     » goto parent     » topic index » view message » categorize

6. Re: Control question

DerekParnell said...
DonCole said...

What I want to know is which EditText control eg. EditText557, EditText558, EditText559 etc...

By default, each control as it is created is given a name based on the 'caption text' for it. This is 'sort of' okay but not very precise. However, you can give any control its own name and later, given a control id, get the name for it.

    EditText557 = createEx(EditText, "", win, ...) 
    setIdName(EditText557, "SurName") 
 
    ... 
 
    if equal( getNameId(someid), "SurName") then ... 

Also note that the name given to a control will be stripped of any non-alphabetic characters except the underscore. Thus setIdName(x, "My great name!") causes getNameId(x) to return "Mygreatname".

Another potential issue is that it is quite possible to have duplicate ID names. Win32lib doesn't really care if you give two different controls that same ID name. That's up to you to monitor.

If it would be useful, I could update the IDE to automatically set each control's name to the name used by the IDE, such that it would generate code like ...

constant EditText557 = createEx(EditText, "", win, ...) 
    setIdName(EditText557, "EditText557") 

Judith's IDE, under properties, has a "Name and ENTER" row that I thouight was used for that purpose.

That's what I did.

I have a long program with several layers and no IDE.

I created an IDE with exw2prj-Frontend.exw

Changed some names and lauched an .exw from IDE.

Every thing worked fine except I've got some EditTexts showing up where I don't want them.

I would like to delete them or change thier Layer # but I don't know which EditTexts they are.

I know there handler number.

Thanks for you input on this matter. If you have any ideas let me know.

Don Cole

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu