Re: listbox commands and collection variables

2019-01-23 Thread Kirk Brooks via 4D_Tech
John,
On Wed, Jan 23, 2019 at 6:31 PM John DeSoi via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> $1 is a pointer to the collection listbox variable and the debugger shows
> it has 10 elements. The object name on the form is the same as the variable
> name. If I execute it with the name, $hdrVars has 4 elements. But all
> arrays have zero elements if I use the dereferenced pointer.
>
Well assuming your listbox has 4 columns that's what you should expect. The
columns don't (can't) have pointers to them.

I encourage you to work with Form in this case. Collection based listboxes
are extremely easy to work with by putting the listbox in a form by itself
and dropping that subform onto forms that require it. When the subform
object is an object or collection you put the collection in the subform
object. The subform code itself is totally generic because it's all working
in the context of the subform. I like to make the subform an object
constructed like so:

{ "data":collection, "config": object }

The listbox collection is Form.data and the config object has details about
setting it up. Keep in mind that working with collections is working with
references - so I'm not doubling or tripling the amount of memory used by
putting the listbox in the subform. It's like using pointers but easier.
And the changes made in the listbox are immediately reflected in the data
collection of the subform object.



> > The listbox correctly fired an On column moved event and *LISTBOX MOVED
> > COLUMN NUMBER*(*;"listBox";$pos1;$pos2) correctly populated.
>
> You tried this using a dereference pointer? This was the one that was not
> working last night that made me decide to post something.
>

I rarely use pointers with listboxes anymore. It shouldn't matter but
perhaps it does. I find listbox code especially easy to make generic using
names instead. In this case I only tested one call using a pointer.

I think if you are seeing a difference between using a pointer and using
the name there is something about the pointer that's weird. Maybe because
of naming the collection and the listbox object the same thing?

-- 
Kirk Brooks
San Francisco, CA
===

*We go vote - they go home*
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: listbox commands and collection variables

2019-01-23 Thread John DeSoi via 4D_Tech
Hi Kirk,

> I'm not able to replicate all of the issues you mention with a collection
> based listbox. To test I made a form and added a collection based listbox
> with two columns. To open it I made a method, created a collection with 10
> elements comprised of objects and had the listbox displace the data. I
> added a button, selected a row and ran the following code:

Thanks for taking the time to test. Perhaps there is something strange about my 
structure. But I'm directly testing by commenting out the dereference pointer 
method (does not work) and then using the named object method (works). This is 
converting previous code with the other types of listboxes that had no issues. 
In all cases I'm building the listboxes dynamically, maybe that has something 
to do with it.

I just tested this again in the debugger stepping through both cases:

ARRAY TEXT($colNames;0)
ARRAY TEXT($hdrNames;0)
ARRAY POINTER($colVars;0)
ARRAY POINTER($hdrVars;0)
ARRAY BOOLEAN($visible;0)
ARRAY POINTER($styles;0)

If (True)  //Bug in 17 - does not work with collection based listbox pointer.
  $name:=Pointer_name ($1)
  LISTBOX GET 
ARRAYS(*;$name;$colNames;$hdrNames;$colVars;$hdrVars;$visible;$styles)
Else 
  LISTBOX GET 
ARRAYS($1->;$colNames;$hdrNames;$colVars;$hdrVars;$visible;$styles)
End if 

$1 is a pointer to the collection listbox variable and the debugger shows it 
has 10 elements. The object name on the form is the same as the variable name. 
If I execute it with the name, $hdrVars has 4 elements. But all arrays have 
zero elements if I use the dereferenced pointer.


> The listbox correctly fired an On column moved event and *LISTBOX MOVED
> COLUMN NUMBER*(*;"listBox";$pos1;$pos2) correctly populated.

You tried this using a dereference pointer? This was the one that was not 
working last night that made me decide to post something.

Thanks,

John DeSoi, Ph.D.


**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: listbox commands and collection variables

2019-01-23 Thread Kirk Brooks via 4D_Tech
Hey John,
I'm not able to replicate all of the issues you mention with a collection
based listbox. To test I made a form and added a collection based listbox
with two columns. To open it I made a method, created a collection with 10
elements comprised of objects and had the listbox displace the data. I
added a button, selected a row and ran the following code:

*LISTBOX GET CELL POSITION*(*;"listBox";$column;$row)


$ptr:=*OBJECT Get pointer*(Object named;"listBox")

*LISTBOX SELECT ROW*($ptr->;2)


*LISTBOX SELECT ROW*(*;"listBox";2)


*ARRAY BOOLEAN*($aVisible;0)

*ARRAY POINTER*($aColVars;0)

*ARRAY POINTER*($aHeaderVars;0)

*ARRAY POINTER*($aStyles;0)

*ARRAY TEXT*($aColNames;0)

*ARRAY TEXT*($aHeaderNames;0)


*LISTBOX GET ARRAYS*(*;"listBox";$aColNames;$aHeaderNames;$aColVars;
$aHeaderVars;$aVisible;$aStyles)


*OBJECT GET COORDINATES*(*;"listBox";$left;$top;$right;$bottom)


Everything worked as expected. $aColVars contains all null values but
that's expected because there are no arrays. The column names and other
vars populated correctly.

The listbox correctly fired an On column moved event and *LISTBOX MOVED
COLUMN NUMBER*(*;"listBox";$pos1;$pos2) correctly populated.

I didn't try OBJECT MOVE.

Perhaps the code you tested was using a pointer to the boolean array of the
array listbox? If you modify your code, just to test, to use the object
name instead of the pointer do you still get the unexpected results?

On Tue, Jan 22, 2019 at 7:56 PM John DeSoi via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> 17.0 HF4 Mac
>
> I've noticed that a lot of generic listbox code fails with collection
> variables. For example, in passing a listbox pointer to a method such as
>
> LISTBOX SELECT ROW($arrayListbox->;$row) `works
>
> LISTBOX SELECT ROW($selectionLisbox->;$row) `works
>
> LISTBOX SELECT ROW($collectionLisbox->;$row) `does not work
>
> Other commands that don't seem work the same with collection list boxes
> include:
>
> LISTBOX GET ARRAYS
> LISTBOX MOVED COLUMN NUMBER
> OBJECT GET COORDINATES
> OBJECT MOVE
>
> Something to watch out for if you are converting code to work with
> collection listboxes. You have to change everything to use the object name
> instead of the variable.
>
> John DeSoi, Ph.D.
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
Kirk Brooks
San Francisco, CA
===

*We go vote - they go home*
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: SDI on WIndows doesnt respect a toolbar

2019-01-23 Thread Keisuke Miyako via 4D_Tech
I am not a great fan of toolbars, but...

I think you can move them around with the mouse (shift+control+left 
button+right button)

in case of emergency (same with window type 2=modal)

2019/01/23 21:43、Piotr Chabot Stadhouders via 4D_Tech 
<4d_tech@lists.4d.com>のメール:
Is this normal behavior?
Does this make sense?


**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Sort messes up Listbox selection when in a transaction

2019-01-23 Thread Pat Bensky via 4D_Tech
Using v17r3, Mac:

I have a listbox that displays a selection of records from the [ListItems]
table, which are related to a record in the [Lists] table.
User can select an item in the list and click the Delete button to delete a
[ListItem] record. The code that runs:

*USE SET*("ListboxSet0")

*DELETE SELECTION*([ListItems])

*QUERY*([ListItems];[ListItems]ListNumber=[Lists]RecordNumber)

*ORDER BY*([ListItems];[ListItems]ItemText)

What happens is that after the ORDER BY line, the selection of [ListItems]
records changes. For example:

Click Delete button: there are 51 ListItems selected
*USE SET*("ListboxSet0") now one ListItem is selected

*DELETE SELECTION*([ListItems])  0 ListItems selected

*QUERY*([ListItems];[ListItems]ListNumber=[Lists]RecordNumber) 50
ListItems selected

*ORDER BY*([ListItems];[ListItems]ItemText)Now there are 12 ListItems
selected!


The same thing occurs if a new record is added to ListItems.


Note that this running inside a transaction. If I insert

VALIDATE TRANSDACTION

after deleting or adding a record, it all works correctly. But I don't want
to validate the transaction at that point, and I don't understand why that
would be necessary.


Bug?


PB


-- 
*
CatBase - Top Dog in Data Publishing
tel: +44 (0) 207 118 7889
w: http://www.catbase.com
skype: pat.bensky
*
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Getting the workstation name for a locked record

2019-01-23 Thread Ben Kershaw via 4D_Tech
Jeffrey Kain wrote:

>We have a bunch of dedicated job clients that all log in to 4D with the same 
>username. When a locked record occurs (I'm using LOCKED BY),
>I want to display the workstation name that's holding the lock... is there a 
>way to get this, other than to assign each workstation a unique username?

Take a look at "Get locked records info”: 
https://doc.4d.com/4Dv16/4D/16.4/Get-locked-records-info.301-3978761.en.html

"The Get locked records info command returns an object containing different 
information about the currently locked record(s) in aTable.
Note: The command works only with 4D and 4D Server. It returns an invalid 
object when called from 4D Remote. However, it can be called in this context if 
the "Execute on server" option is activated for the calling method. In this 
case, the object returned will contain information about the server. When 
called from a component, it always applies to the host database.

… Object containing information similar to the LOCKED BY command but applied to 
the record, the difference being that Get locked records info returns the user 
name defined in the system and not that of the 4D user…"

Regards,
Ben Kershaw
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Getting the workstation name for a locked record

2019-01-23 Thread Tom Benedict via 4D_Tech
Hi Jeff,

You can get the accountName and machineName from the Get system info command. 
Would that help?

Tom

> On Jan 23, 2019, at 11:43, Jeffrey Kain via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> We have a bunch of dedicated job clients that all log in to 4D with the same 
> username. When a locked record occurs (I'm using LOCKED BY), I want to 
> display the workstation name that's holding the lock... is there a way to get 
> this, other than to assign each workstation a unique username?
> 
> Jeff
> 
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Getting the workstation name for a locked record

2019-01-23 Thread Jeffrey Kain via 4D_Tech
We have a bunch of dedicated job clients that all log in to 4D with the same 
username. When a locked record occurs (I'm using LOCKED BY), I want to display 
the workstation name that's holding the lock... is there a way to get this, 
other than to assign each workstation a unique username?

Jeff

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Socket Communication

2019-01-23 Thread spiffyguy via 4D_Tech
Hi everyone,

Just wanted to followup and let you know that I am on the schedule for the
next 4DMethod webinar session on March 13th where I will present my
component and go through the "why" and especially the "how" with examples
and benefits.

https://4dmethod.com/schedule/

Thanks Brent for organizing the 4DMethod blog and creating this platform for
the 4D community to share!

- Matt




--
Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

SDI on WIndows doesnt respect a toolbar

2019-01-23 Thread Piotr Chabot Stadhouders via 4D_Tech
Hi,

I am testing the SDI interface on Windows with 4Dv17 64-bit.

I am happy to get rid of the gray background, however, the windows now don't 
respect the use of a toolbar anymore
I can maximize the windows, and the titlebar gets under the toolbar, so no way 
to move or close the window anymore.

Is this normal behavior?
Does this make sense?
Does using a toolbar with SDI make sense (I think it does)
Is this a bug?
Is there anything I can do about it?

Gr,
Piotr


**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**