Combobox doesn't work after moving from macOS

Thought I could migrate my project from MacOS to Windows without issue.

My project successfully built and executed on Windows, but EVERY combobox I’m using in the software is BROKEN. Nothing I type appears in the combobox. The handler searches for items that match the alpha, when I select one from the popup list, it does not appear visibly in the field. I can’t tell whether a loop situation with selectionChanged has occurred, there’s no code written in that event..

There may be something I’ve created in my code causing this. The code, in the combobox, works on Mac. The notebook I purchased a 2023 running Win11-Home.

This code works fine in the Mac build. No idea what I’m missing to see it working on Windows:

Var i as integer
Var j as integer
Var nameArray(0) as string
Var isNewName as Boolean
if not suppressSelChange then
suppressSelChange=true
me.text = UpperCase(left(me.text,1))+right(me.text,len(me.text)-1)
suppressSelChange=false
nameChars = me.text
me.RemoveAllRows
if len(nameChars) > 0 then
for i = 0 to LedgerWindow.Cash.RowCount-1
if Left(LedgerWindow.Cash.cellTextAt(i,1),Len(nameChars))=nameChars then
isNewName=true
for j = 0 to nameArray.LastIndex
if nameArray(j) = nthField(LedgerWindow.Cash.cellTextAt(i,1),chr(9),1) then
isNewName = false
end if
next
if isNewName = true then
nameArray.Add nthField(LedgerWindow.Cash.cellTextAt(i,1),chr(9),1)
end if
end if
next
nameArray.sort
for i = 0 to nameArray.LastIndex
if nameArray(i)<>“” then
me.addRow nameArray(i)
end if
next
isThere(namechars)
end if
me.SelectionStart = len(nameChars)
end if

Note: the suppressSelChange property I created was so I could capitalize the first character in the entry:

suppressSelChange=true
me.text = UpperCase(left(me.text,1))+right(me.text,len(me.text)-1)
suppressSelChange=false

If I remove the suppressSelChange property the code between them fails. I’ve moved my code between the selectionChanged and the TextChanged events. It’s in the TextChanged event because when in SelectionChanged the code goes into an infinite loop.

I’m hoping someone may notice something I haven’t learned about yet. I’ve did not expect this when I ran my project on a Windows box.

Pretty sure I need to provide more clarity here, but I’ve described this best I can. I know when there is no code entered in the combobox, what I type will appear (running on Windows). If comboboxes are broken, I wish I’d heard about that one before upgrading to create a Windows build. I know I had trouble on the Mac with combobox, not surprised this is happening.

An additional request, how does AutoCompletion work? I had nothing but difficulty understanding it, so I kept it disabled.

It would be helpful if you could make a sample project so others could try it out, see the behavior and tweak.

This looks way difficult to pursue. I thought twenty five years later the cross-platform capability would be improved. Code that works on one platform should work on the other. That’s why I upgraded from Lite to Desktop. I may develop entirely different for Windows, but porting what I’ve created on Mac over to Windows is a real non-starter.

My situation does not allow for a non-starting issue to figure out. I believe the frameworks, and much of what I created moved to Windows 11 quite well. But the data input windows are hosed. I only know it handles data properly throughout because i opened an already existed file of data and reports come up fine that I’ve noticed so far. But being unable to add new data tells me not to waste more time with this. I felt better, twenty-four hours age, deciding not to try protein from Mac to Windows, better off to build from scratch on Windows, probably something entirely different .

It may be that the way Microsoft is integrating AI into their OS could be causing problems, especially if MS is collecting information about what my computer is doing. The news was dismaying. A privacy tech was recommending to not upgrade from Win 10.

The issue may be that on Windows, modifying me.text within the TextChanged event can cause the text to be cleared due to the way Windows handles ComboBox Text updates differently than on macOS. But we would really need a sample project which shows your described behavior, before we can even start.


A little tip for better clarity in your code (this makes it easier to find errors with the naked eye): Avoid deep nesting. I would like to illustrate this using your current code snippet.

Instead of:

If Not suppressSelChange Then
   ...many many nested code lines...
end if

do a

If suppressSelChange Then Return

In short: Always keep an eye out for early exits. :wink:


And please use the Code-Formatting Feature of the Forum for future Code-Posts. :slight_smile:

4 Likes

Took a few days to study the combobox and try to understand it more completely. Thanks, Sascha, for letting me know the issue happening to comboboxes on Windows. I believe I need to rewrite the code to avoid modifying “me.text” and utilize the AddAllRows method.

An error occurs overtime I attempt to upload the .zip file of my project, preventing it to be available at the topic’s thread. The .zip file includes a ReadMe that asks the question about why using the “suppressSelChange” property conditional statement prevents the Mac from throwing a stackOverflowException; respectively similar to what Windows is doing with this TextChanged Event handler. No idea how to get this online; I can’t figure why I came up with “suppressSelChange” to begin with.

Thanks for your guidance on this, and any new information that may be helpful.