2

I've made a simple Android app in Delphi which creates a login form. The issue I'm having is that when I run it on Android phone, the app starts fine, but pops up a message "Class TFormLogin not found" (approx 100ms after FormLogin is already shown). Despite the FormLogin being created and working as intended. When I click ok the message goes away and the app continues to work normally.

enter image description here

What does the message "Class TFormLogin not found" mean and how to make it go away?

P.S. Since I've already found the cause. Culprit of the error was usage of StyleBook in the project.


As requested, here's MCVE. The error appears in new blank multi-platform project without any code added in the PAS or DPR. This FMX form setup is enough:

object Form1: TForm1
  StyleName = 'bg'
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 480
  ClientWidth = 640
  StyleBook = StyleBook1
  StyleLookup = 'bg'
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  DesignerMasterStyle = 0
  object StyleBook1: TStyleBook
    Styles = <
      item
      end>
    Left = 304
    Top = 224
  end
end
Kromster
  • 7,181
  • 7
  • 63
  • 111

1 Answers1

2

This came out to be StyleBook error message (wording should have been more descriptive, right).

The error was caused by TFormLogin having a StyleBook and StyleLookup and StyleName references specified in FMX, wheres StyleBook did not had the corresponding style StyleName in it.

P.S. What puzzles me, when either StyleLookup or StyleName is clear, code works fine. When both are filled - error message appears.

Kromster
  • 7,181
  • 7
  • 63
  • 111
  • Answer should be possible to reach given the question. This question misses the required [mcve]. – David Heffernan Jan 17 '19 at 09:06
  • @DavidHeffernan this is a good rule, BUT .. when anyone else sees this "Class TForm1 not found", what do you think they will do and what will their search query be? Given that error message is so vague. P.S. I generally treat -1 as the hint says - "answer is not useful". Can not agree that *this* answer is *not* useful. – Kromster Jan 17 '19 at 09:10
  • It's not useful to the other people that arrive with this error message but for whom the cause is different. – David Heffernan Jan 17 '19 at 09:12
  • @DavidHeffernan let me reinterpret: it is useful for people who arrive with this error message but for whom the cause is this. So if this is helpful for some - let it live and let it be expanded with other answers to serve more people. And shame on whoever wrote this error message for not adding enough context to it. – Kromster Jan 17 '19 at 09:17
  • Thank you, that's just better. Presumably the fix is to name the style `'bg'` in the style book properties? – David Heffernan Jan 17 '19 at 11:00
  • What puzzles me, when either `StyleLookup` or `StyleName` is clear, code works fine. When both are filled - error message appears. – Kromster Jan 17 '19 at 11:02